face-recognition.js/public_html/js/lib/min/permanent-storage.js

4 lines
1000 B
JavaScript
Raw Normal View History

var PermanentStorage=function(){};
2016-11-03 09:36:23 +00:00
PermanentStorage.prototype={store:function(a,b){var c,d;a=a||null;a="string"===typeof a?a:null;if(!(a&&b instanceof Function))return!1;c=new FormData;c.append("command","store");c.append("data",a);d=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest");d.addEventListener("readystatechange",function(a){d.readyState-4||!~[0,200].indexOf(d.status)||"success"==d.responseText&&b()||console.warn("[PermanentStorage] storeError")},!1);d.open("POST","./permanent-storage/",
!0);d.send(c);return!0},fetch:function(a){var b,c;if(!(a instanceof Function))return!1;c=new FormData;c.append("command","fetch");b=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHttpRequest");b.addEventListener("readystatechange",function(c){b.readyState-4||!~[0,200].indexOf(b.status)||"error"!=b.responseText&&a(b.responseText)||console.warn("[PermanentStorage] fetchError")},!1);b.open("POST","./permanent-storage/",!0);b.send(c)}};