localforage
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "localforage", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "dist/localforage.js" |
{ | ||
"name": "localforage", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "then/promise": "5.0.0" |
@@ -1,1 +0,1 @@ | ||
!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),a("promise/asap",["exports"],function(a){"use strict";function b(){return function(){process.nextTick(e)}}function c(){var a=0,b=new i(e),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function d(){return function(){j.setTimeout(e,1)}}function e(){for(var a=0;a<k.length;a++){var b=k[a],c=b[0],d=b[1];c(d)}k=[]}function f(a,b){var c=k.push([a,b]);1===c&&g()}var g,h="undefined"!=typeof window?window:{},i=h.MutationObserver||h.WebKitMutationObserver,j="undefined"!=typeof global?global:void 0===this?window:this,k=[];g="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():i?c():d(),a.asap=f}),a("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:void(c[a]=b)}var c={instrument:!1};a.config=c,a.configure=b}),a("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function d(){var a;a="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();b||(a.Promise=e)}var e=a.Promise,f=b.isFunction;c.polyfill=d}),a("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){if(!v(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],j(a,this)}function j(a,b){function c(a){o(b,a)}function d(a){q(b,a)}try{a(c,d)}catch(e){d(e)}}function k(a,b,c,d){var e,f,g,h,i=v(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;n(b,e)||(i&&g?o(b,e):h?q(b,f):a===D?o(b,e):a===E&&q(b,e))}function l(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+D]=c,e[f+E]=d}function m(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],k(b,c,d,f);a._subscribers=null}function n(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(u(b)&&(d=b.then,v(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?o(a,d):p(a,d)))},function(b){return c?!0:(c=!0,void q(a,b))}),!0}catch(e){return c?!0:(q(a,e),!0)}return!1}function o(a,b){a===b?p(a,b):n(a,b)||p(a,b)}function p(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(r,a))}function q(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(s,a))}function r(a){m(a,a._state=D)}function s(a){m(a,a._state=E)}var t=a.config,u=(a.configure,b.objectOrFunction),v=b.isFunction,w=(b.now,c.all),x=d.race,y=e.resolve,z=f.reject,A=g.asap;t.async=A;var B=void 0,C=0,D=1,E=2;i.prototype={constructor:i,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;t.async(function(){k(c._state,d,e[c._state-1],c._detail)})}else l(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},i.all=w,i.race=x,i.resolve=y,i.reject=z,h.Promise=i}),a("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),a("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),a("promise/resolve",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.resolve=b}),a("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),b("promise/polyfill").polyfill()}(),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new l(function(a,d){var e=m.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(){e.result.createObjectStore(c.storeName)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),b(a)},g.onerror=function(){d(g.error)}})["catch"](d)});return j(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new l(function(c,e){d.ready().then(function(){var f=d._dbInfo,g=f.db.transaction(f.storeName,"readwrite").objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);h.onsuccess=function(){void 0===b&&(b=null),c(b)},h.onerror=function(){e(h.error)}})["catch"](e)});return j(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite").objectStore(e.storeName),g=f["delete"](a);g.onsuccess=function(){b()},g.onerror=function(){d(g.error)},g.onabort=function(a){var b=a.target.error;"QuotaExceededError"===b&&d(b)}})["catch"](d)});return j(d,b),d}function e(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite").objectStore(d.storeName),f=e.clear();f.onsuccess=function(){a()},f.onerror=function(){c(f.error)}})["catch"](c)});return j(c,a),c}function f(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function g(a,b){var c=this,d=new l(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return i(d,b),d}function h(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function i(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}function j(a,b){b&&a.then(function(a){k(b,a)},function(a){b(a)})}function k(a,b){return a?setTimeout(function(){return a(null,b)},0):void 0}var l="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,m=m||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(m){var n={_driver:"asyncStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("asyncStorage",function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:this.asyncStorage=n}}.call(window),function(){"use strict";function a(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=c.name+"/",b._dbInfo=c,m.resolve()}function b(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo.keyPrefix,d=n.length-1;d>=0;d--){var e=n.key(d);0===e.indexOf(c)&&n.removeItem(e)}a()})["catch"](c)});return l(c,a),c}function c(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){try{var e=c._dbInfo,f=n.getItem(e.keyPrefix+a);f&&(f=h(f)),b(f)}catch(g){d(g)}})["catch"](d)});return l(d,b),d}function d(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var d,e=c._dbInfo;try{d=n.key(a)}catch(f){d=null}d&&(d=d.substring(e.keyPrefix.length)),b(d)})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo,d=n.length,e=[],f=0;d>f;f++)e.push(n.key(f).substring(c.keyPrefix.length));a(e)})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var b=n.length;a(b)})["catch"](c)});return l(c,a),c}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var d=c._dbInfo;n.removeItem(d.keyPrefix+a),b()})["catch"](d)});return l(d,b),d}function h(a){if(a.substring(0,q)!==p)return JSON.parse(a);for(var b=a.substring(C),c=a.substring(q,C),d=new ArrayBuffer(2*b.length),e=new Uint16Array(d),f=b.length-1;f>=0;f--)e[f]=b.charCodeAt(f);switch(c){case r:return d;case s:return new Blob([d]);case t:return new Int8Array(d);case u:return new Uint8Array(d);case v:return new Uint8ClampedArray(d);case w:return new Int16Array(d);case y:return new Uint16Array(d);case x:return new Int32Array(d);case z:return new Uint32Array(d);case A:return new Float32Array(d);case B:return new Float64Array(d);default:throw new Error("Unkown type: "+c)}}function i(a){var b="",c=new Uint16Array(a);try{b=String.fromCharCode.apply(null,c)}catch(d){for(var e=0;e<c.length;e++)b+=String.fromCharCode(c[e])}return b}function j(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(g)}}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;j(b,function(b,g){if(g)e(g);else{try{var h=d._dbInfo;n.setItem(h.keyPrefix+a,b)}catch(i){("QuotaExceededError"===i.name||"NS_ERROR_DOM_QUOTA_REACHED"===i.name)&&e(i)}c(f)}})})["catch"](e)});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,n=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;n=this.localStorage}catch(o){return}var p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length,D={_driver:"localStorageWrapper",_initStorage:a,getItem:c,setItem:k,removeItem:g,clear:b,length:f,key:d,keys:e};"function"==typeof define&&define.amd?define("localStorageWrapper",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.localStorageWrapper=D}.call(window),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];return new n(function(d,e){try{c.db=o(c.name,String(c.version),c.description,c.size)}catch(f){return b.setDriver("localStorageWrapper").then(function(){return b._initStorage(a)}).then(d)["catch"](e)}c.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=c,d()},function(a,b){e(b)})})})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=j(d)),b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new n(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;k(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})})["catch"](e)});return l(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function g(a,b){var c=this,d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function h(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=m[c[b]>>2],d+=m[(3&c[b])<<4|c[b+1]>>4],d+=m[(15&c[b+1])<<2|c[b+2]>>6],d+=m[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function j(a){if(a.substring(0,q)!==p)return JSON.parse(a);var b,c,d,e,f,g=a.substring(C),h=a.substring(q,C),i=.75*g.length,j=g.length,k=0;"="===g[g.length-1]&&(i--,"="===g[g.length-2]&&i--);var l=new ArrayBuffer(i),n=new Uint8Array(l);for(b=0;j>b;b+=4)c=m.indexOf(g[b]),d=m.indexOf(g[b+1]),e=m.indexOf(g[b+2]),f=m.indexOf(g[b+3]),n[k++]=c<<2|d>>4,n[k++]=(15&d)<<4|e>>2,n[k++]=(3&e)<<6|63&f;switch(h){case r:return l;case s:return new Blob([l]);case t:return new Int8Array(l);case u:return new Uint8Array(l);case v:return new Uint8ClampedArray(l);case w:return new Int16Array(l);case y:return new Uint16Array(l);case x:return new Int32Array(l);case z:return new Uint32Array(l);case A:return new Float32Array(l);case B:return new Float64Array(l);default:throw new Error("Unkown type: "+h)}}function k(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(null,g)}}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,o=this.openDatabase,p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length;if(o){var D={_driver:"webSQLStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("webSQLStorage",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.webSQLStorage=D}}.call(window),function(){"use strict";function a(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(arguments[0][c]=b[c])}return arguments[0]}function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function c(c){this._config=a({},i,c),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var d=0;d<g.length;d++)b(this,g[d]);this.setDriver(f)}var d="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},f=[e.INDEXEDDB,e.WEBSQL,e.LOCALSTORAGE],g=["clear","getItem","key","keys","length","removeItem","setItem"],h={DEFINE:1,EXPORT:2,WINDOW:3},i={description:"",name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},j=h.WINDOW;"function"==typeof define&&define.amd?j=h.DEFINE:"undefined"!=typeof module&&module.exports&&(j=h.EXPORT);var k=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[e.WEBSQL]=!!a.openDatabase,c[e.INDEXEDDB]=!!function(){try{return b&&"function"==typeof b.open&&null===b.open("_localforage_spec_test",1).onupgradeneeded}catch(a){return!1}}(),c[e.LOCALSTORAGE]=!!function(){try{return localStorage&&"function"==typeof localStorage.setItem}catch(a){return!1}}(),c}(this),l=this;c.prototype.INDEXEDDB=e.INDEXEDDB,c.prototype.LOCALSTORAGE=e.LOCALSTORAGE,c.prototype.WEBSQL=e.WEBSQL,c.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return!0}return"string"==typeof a?this._config[a]:this._config},c.prototype.driver=function(){return this._driver||null},c.prototype.ready=function(a){var b=this,c=new d(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)})["catch"](c)});return c.then(a,a),c},c.prototype.setDriver=function(a,b,c){var e=this;return"string"==typeof a&&(a=[a]),this._driverSet=new d(function(b,c){var f=e._getFirstSupportedDriver(a);if(!f){var g=new Error("No available storage method found.");return e._driverSet=d.reject(g),void c(g)}if(e._dbInfo=null,e._ready=null,j===h.DEFINE)return void require([f],function(a){e._extend(a),b()});if(j===h.EXPORT){var i;switch(f){case e.INDEXEDDB:i=require("./drivers/indexeddb");break;case e.LOCALSTORAGE:i=require("./drivers/localstorage");break;case e.WEBSQL:i=require("./drivers/websql")}e._extend(i)}else e._extend(l[f]);b()}),this._driverSet.then(b,c),this._driverSet},c.prototype.supports=function(a){return!!k[a]},c.prototype._extend=function(b){a(this,b)},c.prototype._getFirstSupportedDriver=function(a){var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};if(a&&b(a))for(var c=0;c<a.length;c++){var d=a[c];if(this.supports(d))return d}return null},c.prototype.createInstance=function(a){return new c(a)};var m=new c;j===h.DEFINE?define("localforage",function(){return m}):j===h.EXPORT?module.exports=m:this.localforage=m}.call(window); | ||
!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),a("promise/asap",["exports"],function(a){"use strict";function b(){return function(){process.nextTick(e)}}function c(){var a=0,b=new i(e),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function d(){return function(){j.setTimeout(e,1)}}function e(){for(var a=0;a<k.length;a++){var b=k[a],c=b[0],d=b[1];c(d)}k=[]}function f(a,b){var c=k.push([a,b]);1===c&&g()}var g,h="undefined"!=typeof window?window:{},i=h.MutationObserver||h.WebKitMutationObserver,j="undefined"!=typeof global?global:void 0===this?window:this,k=[];g="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():i?c():d(),a.asap=f}),a("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:void(c[a]=b)}var c={instrument:!1};a.config=c,a.configure=b}),a("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function d(){var a;a="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();b||(a.Promise=e)}var e=a.Promise,f=b.isFunction;c.polyfill=d}),a("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){if(!v(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],j(a,this)}function j(a,b){function c(a){o(b,a)}function d(a){q(b,a)}try{a(c,d)}catch(e){d(e)}}function k(a,b,c,d){var e,f,g,h,i=v(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;n(b,e)||(i&&g?o(b,e):h?q(b,f):a===D?o(b,e):a===E&&q(b,e))}function l(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+D]=c,e[f+E]=d}function m(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],k(b,c,d,f);a._subscribers=null}function n(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(u(b)&&(d=b.then,v(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?o(a,d):p(a,d)))},function(b){return c?!0:(c=!0,void q(a,b))}),!0}catch(e){return c?!0:(q(a,e),!0)}return!1}function o(a,b){a===b?p(a,b):n(a,b)||p(a,b)}function p(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(r,a))}function q(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(s,a))}function r(a){m(a,a._state=D)}function s(a){m(a,a._state=E)}var t=a.config,u=(a.configure,b.objectOrFunction),v=b.isFunction,w=(b.now,c.all),x=d.race,y=e.resolve,z=f.reject,A=g.asap;t.async=A;var B=void 0,C=0,D=1,E=2;i.prototype={constructor:i,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;t.async(function(){k(c._state,d,e[c._state-1],c._detail)})}else l(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},i.all=w,i.race=x,i.resolve=y,i.reject=z,h.Promise=i}),a("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),a("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),a("promise/resolve",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.resolve=b}),a("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),b("promise/polyfill").polyfill()}(),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new l(function(a,d){var e=m.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(){e.result.createObjectStore(c.storeName)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),b(a)},g.onerror=function(){d(g.error)}})["catch"](d)});return j(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new l(function(c,e){d.ready().then(function(){var f=d._dbInfo,g=f.db.transaction(f.storeName,"readwrite").objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);h.onsuccess=function(){void 0===b&&(b=null),c(b)},h.onerror=function(){e(h.error)}})["catch"](e)});return j(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite").objectStore(e.storeName),g=f["delete"](a);g.onsuccess=function(){b()},g.onerror=function(){d(g.error)},g.onabort=function(a){var b=a.target.error;"QuotaExceededError"===b&&d(b)}})["catch"](d)});return j(d,b),d}function e(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite").objectStore(d.storeName),f=e.clear();f.onsuccess=function(){a()},f.onerror=function(){c(f.error)}})["catch"](c)});return j(c,a),c}function f(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function g(a,b){var c=this,d=new l(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return i(d,b),d}function h(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function i(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}function j(a,b){b&&a.then(function(a){k(b,a)},function(a){b(a)})}function k(a,b){return a?setTimeout(function(){return a(null,b)},0):void 0}var l="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,m=m||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(m){var n={_driver:"asyncStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("asyncStorage",function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:this.asyncStorage=n}}.call(window),function(){"use strict";function a(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=c.name+"/",b._dbInfo=c,m.resolve()}function b(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo.keyPrefix,d=n.length-1;d>=0;d--){var e=n.key(d);0===e.indexOf(c)&&n.removeItem(e)}a()})["catch"](c)});return l(c,a),c}function c(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){try{var e=c._dbInfo,f=n.getItem(e.keyPrefix+a);f&&(f=h(f)),b(f)}catch(g){d(g)}})["catch"](d)});return l(d,b),d}function d(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var d,e=c._dbInfo;try{d=n.key(a)}catch(f){d=null}d&&(d=d.substring(e.keyPrefix.length)),b(d)})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo,d=n.length,e=[],f=0;d>f;f++)e.push(n.key(f).substring(c.keyPrefix.length));a(e)})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var b=n.length;a(b)})["catch"](c)});return l(c,a),c}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var d=c._dbInfo;n.removeItem(d.keyPrefix+a),b()})["catch"](d)});return l(d,b),d}function h(a){if(a.substring(0,q)!==p)return JSON.parse(a);for(var b=a.substring(C),c=a.substring(q,C),d=new ArrayBuffer(2*b.length),e=new Uint16Array(d),f=b.length-1;f>=0;f--)e[f]=b.charCodeAt(f);switch(c){case r:return d;case s:return new Blob([d]);case t:return new Int8Array(d);case u:return new Uint8Array(d);case v:return new Uint8ClampedArray(d);case w:return new Int16Array(d);case y:return new Uint16Array(d);case x:return new Int32Array(d);case z:return new Uint32Array(d);case A:return new Float32Array(d);case B:return new Float64Array(d);default:throw new Error("Unkown type: "+c)}}function i(a){var b="",c=new Uint16Array(a);try{b=String.fromCharCode.apply(null,c)}catch(d){for(var e=0;e<c.length;e++)b+=String.fromCharCode(c[e])}return b}function j(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(g)}}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;j(b,function(b,g){if(g)e(g);else{try{var h=d._dbInfo;n.setItem(h.keyPrefix+a,b)}catch(i){("QuotaExceededError"===i.name||"NS_ERROR_DOM_QUOTA_REACHED"===i.name)&&e(i)}c(f)}})})["catch"](e)});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,n=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;n=this.localStorage}catch(o){return}var p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length,D={_driver:"localStorageWrapper",_initStorage:a,getItem:c,setItem:k,removeItem:g,clear:b,length:f,key:d,keys:e};"function"==typeof define&&define.amd?define("localStorageWrapper",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.localStorageWrapper=D}.call(window),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];return new n(function(d,e){try{c.db=o(c.name,String(c.version),c.description,c.size)}catch(f){return b.setDriver("localStorageWrapper").then(function(){return b._initStorage(a)}).then(d)["catch"](e)}c.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=c,d()},function(a,b){e(b)})})})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=j(d)),b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new n(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;k(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})})["catch"](e)});return l(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function g(a,b){var c=this,d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function h(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=m[c[b]>>2],d+=m[(3&c[b])<<4|c[b+1]>>4],d+=m[(15&c[b+1])<<2|c[b+2]>>6],d+=m[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function j(a){if(a.substring(0,q)!==p)return JSON.parse(a);var b,c,d,e,f,g=a.substring(C),h=a.substring(q,C),i=.75*g.length,j=g.length,k=0;"="===g[g.length-1]&&(i--,"="===g[g.length-2]&&i--);var l=new ArrayBuffer(i),n=new Uint8Array(l);for(b=0;j>b;b+=4)c=m.indexOf(g[b]),d=m.indexOf(g[b+1]),e=m.indexOf(g[b+2]),f=m.indexOf(g[b+3]),n[k++]=c<<2|d>>4,n[k++]=(15&d)<<4|e>>2,n[k++]=(3&e)<<6|63&f;switch(h){case r:return l;case s:return new Blob([l]);case t:return new Int8Array(l);case u:return new Uint8Array(l);case v:return new Uint8ClampedArray(l);case w:return new Int16Array(l);case y:return new Uint16Array(l);case x:return new Int32Array(l);case z:return new Uint32Array(l);case A:return new Float32Array(l);case B:return new Float64Array(l);default:throw new Error("Unkown type: "+h)}}function k(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(null,g)}}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,o=this.openDatabase,p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length;if(o){var D={_driver:"webSQLStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("webSQLStorage",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.webSQLStorage=D}}.call(window),function(){"use strict";function a(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(arguments[0][c]=b[c])}return arguments[0]}function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function c(c){this._config=a({},i,c),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var d=0;d<g.length;d++)b(this,g[d]);this.setDriver(f)}var d="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},f=[e.INDEXEDDB,e.WEBSQL,e.LOCALSTORAGE],g=["clear","getItem","key","keys","length","removeItem","setItem"],h={DEFINE:1,EXPORT:2,WINDOW:3},i={description:"",name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},j=h.WINDOW;"function"==typeof define&&define.amd?j=h.DEFINE:"undefined"!=typeof module&&module.exports&&(j=h.EXPORT);var k=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[e.WEBSQL]=!!a.openDatabase,c[e.INDEXEDDB]=!!function(){if("undefined"!=typeof a.openDatabase&&a.navigator&&a.navigator.userAgent&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent))return!1;try{return b&&"function"==typeof b.open&&null===b.open("_localforage_spec_test",1).onupgradeneeded}catch(c){return!1}}(),c[e.LOCALSTORAGE]=!!function(){try{return localStorage&&"setItem"in localStorage&&localStorage.setItem}catch(a){return!1}}(),c}(this),l=this;c.prototype.INDEXEDDB=e.INDEXEDDB,c.prototype.LOCALSTORAGE=e.LOCALSTORAGE,c.prototype.WEBSQL=e.WEBSQL,c.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return!0}return"string"==typeof a?this._config[a]:this._config},c.prototype.driver=function(){return this._driver||null},c.prototype.ready=function(a){var b=this,c=new d(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)})["catch"](c)});return c.then(a,a),c},c.prototype.setDriver=function(a,b,c){var e=this;return"string"==typeof a&&(a=[a]),this._driverSet=new d(function(b,c){var f=e._getFirstSupportedDriver(a);if(!f){var g=new Error("No available storage method found.");return e._driverSet=d.reject(g),void c(g)}if(e._dbInfo=null,e._ready=null,j===h.DEFINE)return void require([f],function(a){e._extend(a),b()});if(j===h.EXPORT){var i;switch(f){case e.INDEXEDDB:i=require("./drivers/indexeddb");break;case e.LOCALSTORAGE:i=require("./drivers/localstorage");break;case e.WEBSQL:i=require("./drivers/websql")}e._extend(i)}else e._extend(l[f]);b()}),this._driverSet.then(b,c),this._driverSet},c.prototype.supports=function(a){return!!k[a]},c.prototype._extend=function(b){a(this,b)},c.prototype._getFirstSupportedDriver=function(a){var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};if(a&&b(a))for(var c=0;c<a.length;c++){var d=a[c];if(this.supports(d))return d}return null},c.prototype.createInstance=function(a){return new c(a)};var m=new c;j===h.DEFINE?define("localforage",function(){return m}):j===h.EXPORT?module.exports=m:this.localforage=m}.call(window); |
/*! | ||
localForage -- Offline Storage, Improved | ||
Version 1.0.1 | ||
Version 1.0.2 | ||
http://mozilla.github.io/localForage | ||
@@ -31,3 +31,3 @@ (c) 2013-2014 Mozilla, Apache License 2.0 | ||
function _initStorage(options) { | ||
var _this = this; | ||
var self = this; | ||
var dbInfo = { | ||
@@ -54,3 +54,3 @@ db: null | ||
dbInfo.db = openreq.result; | ||
_this._dbInfo = dbInfo; | ||
self._dbInfo = dbInfo; | ||
resolve(); | ||
@@ -62,3 +62,3 @@ }; | ||
function getItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -73,4 +73,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -100,3 +100,3 @@ .objectStore(dbInfo.storeName); | ||
function setItem(key, value, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -111,4 +111,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readwrite') | ||
@@ -150,3 +150,3 @@ .objectStore(dbInfo.storeName); | ||
function removeItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -161,4 +161,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readwrite') | ||
@@ -198,7 +198,7 @@ .objectStore(dbInfo.storeName); | ||
function clear(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readwrite') | ||
@@ -223,7 +223,7 @@ .objectStore(dbInfo.storeName); | ||
function length(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -248,3 +248,3 @@ .objectStore(dbInfo.storeName); | ||
function key(n, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -258,4 +258,4 @@ var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -303,7 +303,7 @@ .objectStore(dbInfo.storeName); | ||
function keys(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -424,3 +424,3 @@ .objectStore(dbInfo.storeName); | ||
function _initStorage(options) { | ||
var _this = this; | ||
var self = this; | ||
var dbInfo = {}; | ||
@@ -435,3 +435,3 @@ if (options) { | ||
_this._dbInfo = dbInfo; | ||
self._dbInfo = dbInfo; | ||
return Promise.resolve(); | ||
@@ -461,6 +461,6 @@ } | ||
function clear(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var keyPrefix = _this._dbInfo.keyPrefix; | ||
self.ready().then(function() { | ||
var keyPrefix = self._dbInfo.keyPrefix; | ||
@@ -487,3 +487,3 @@ for (var i = localStorage.length - 1; i >= 0; i--) { | ||
function getItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -498,5 +498,5 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
try { | ||
var dbInfo = _this._dbInfo; | ||
var dbInfo = self._dbInfo; | ||
var result = localStorage.getItem(dbInfo.keyPrefix + key); | ||
@@ -525,6 +525,6 @@ | ||
function key(n, callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var result; | ||
@@ -551,6 +551,6 @@ try { | ||
function keys(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var length = localStorage.length; | ||
@@ -574,5 +574,5 @@ var keys = []; | ||
function length(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
var result = localStorage.length; | ||
@@ -590,3 +590,3 @@ | ||
function removeItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -601,4 +601,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
localStorage.removeItem(dbInfo.keyPrefix + key); | ||
@@ -774,3 +774,3 @@ | ||
function setItem(key, value, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -785,3 +785,3 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
// Convert undefined values to null. | ||
@@ -801,3 +801,3 @@ // https://github.com/mozilla/localForage/pull/42 | ||
try { | ||
var dbInfo = _this._dbInfo; | ||
var dbInfo = self._dbInfo; | ||
localStorage.setItem(dbInfo.keyPrefix + key, value); | ||
@@ -905,3 +905,3 @@ } catch (e) { | ||
function _initStorage(options) { | ||
var _this = this; | ||
var self = this; | ||
var dbInfo = { | ||
@@ -925,4 +925,4 @@ db: null | ||
} catch (e) { | ||
return _this.setDriver("localStorageWrapper").then(function() { | ||
return _this._initStorage(options); | ||
return self.setDriver("localStorageWrapper").then(function() { | ||
return self._initStorage(options); | ||
}).then(resolve)["catch"](reject); | ||
@@ -936,3 +936,3 @@ } | ||
function() { | ||
_this._dbInfo = dbInfo; | ||
self._dbInfo = dbInfo; | ||
resolve(); | ||
@@ -947,3 +947,3 @@ }, function(t, error) { | ||
function getItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -958,4 +958,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -988,3 +988,3 @@ t.executeSql('SELECT * FROM ' + dbInfo.storeName + | ||
function setItem(key, value, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -999,3 +999,3 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
// The localStorage API doesn't return undefined values in an | ||
@@ -1015,3 +1015,3 @@ // "expected" way, so undefined is always cast to null in all | ||
} else { | ||
var dbInfo = _this._dbInfo; | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -1049,3 +1049,3 @@ t.executeSql('INSERT OR REPLACE INTO ' + | ||
function removeItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -1060,4 +1060,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -1083,7 +1083,7 @@ t.executeSql('DELETE FROM ' + dbInfo.storeName + | ||
function clear(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -1107,7 +1107,7 @@ t.executeSql('DELETE FROM ' + dbInfo.storeName, [], | ||
function length(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -1140,7 +1140,7 @@ // Ahhh, SQL makes this one soooooo easy. | ||
function key(n, callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -1165,7 +1165,7 @@ t.executeSql('SELECT key FROM ' + dbInfo.storeName + | ||
function keys(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -1469,13 +1469,28 @@ t.executeSql('SELECT key FROM ' + dbInfo.storeName, [], | ||
// See: https://github.com/mozilla/localForage/issues/128 | ||
var driverSupport = (function(_this) { | ||
var driverSupport = (function(self) { | ||
// Initialize IndexedDB; fall back to vendor-prefixed versions | ||
// if needed. | ||
var indexedDB = indexedDB || _this.indexedDB || _this.webkitIndexedDB || | ||
_this.mozIndexedDB || _this.OIndexedDB || | ||
_this.msIndexedDB; | ||
var indexedDB = indexedDB || self.indexedDB || self.webkitIndexedDB || | ||
self.mozIndexedDB || self.OIndexedDB || | ||
self.msIndexedDB; | ||
var result = {}; | ||
result[DriverType.WEBSQL] = !!_this.openDatabase; | ||
result[DriverType.WEBSQL] = !!self.openDatabase; | ||
result[DriverType.INDEXEDDB] = !!(function() { | ||
// We mimic PouchDB here; just UA test for Safari (which, as of | ||
// iOS 8/Yosemite, doesn't properly support IndexedDB). | ||
// IndexedDB support is broken and different from Blink's. | ||
// This is faster than the test case (and it's sync), so we just | ||
// do this. *SIGH* | ||
// http://bl.ocks.org/nolanlawson/raw/c83e9039edf2278047e9/ | ||
// | ||
// We test for openDatabase because IE Mobile identifies itself | ||
// as Safari. Oh the lulz... | ||
if (typeof self.openDatabase !== 'undefined' && self.navigator && | ||
self.navigator.userAgent && | ||
/Safari/.test(navigator.userAgent) && | ||
!/Chrome/.test(navigator.userAgent)) { | ||
return false; | ||
} | ||
try { | ||
@@ -1494,3 +1509,4 @@ return (indexedDB && | ||
return (localStorage && | ||
typeof localStorage.setItem === 'function'); | ||
('setItem' in localStorage) && | ||
(localStorage.setItem)); | ||
} catch (e) { | ||
@@ -1527,5 +1543,3 @@ return false; | ||
// The actual localForage object that we expose as a module or via a | ||
// global. It's extended by pulling in one of our other libraries. | ||
var _this = this; | ||
var globalObject = this; | ||
@@ -1655,3 +1669,3 @@ function LocalForage(options) { | ||
} else { | ||
self._extend(_this[driverName]); | ||
self._extend(globalObject[driverName]); | ||
} | ||
@@ -1674,2 +1688,4 @@ | ||
// Used to determine which driver we should use as the backend for this | ||
// instance of localForage. | ||
LocalForage.prototype._getFirstSupportedDriver = function(drivers) { | ||
@@ -1697,2 +1713,4 @@ var isArray = Array.isArray || function(arg) { | ||
// The actual localForage object that we expose as a module or via a | ||
// global. It's extended by pulling in one of our other libraries. | ||
var localForage = new LocalForage(); | ||
@@ -1699,0 +1717,0 @@ |
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new l(function(a,d){var e=m.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(){e.result.createObjectStore(c.storeName)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),b(a)},g.onerror=function(){d(g.error)}})["catch"](d)});return j(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new l(function(c,e){d.ready().then(function(){var f=d._dbInfo,g=f.db.transaction(f.storeName,"readwrite").objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);h.onsuccess=function(){void 0===b&&(b=null),c(b)},h.onerror=function(){e(h.error)}})["catch"](e)});return j(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite").objectStore(e.storeName),g=f["delete"](a);g.onsuccess=function(){b()},g.onerror=function(){d(g.error)},g.onabort=function(a){var b=a.target.error;"QuotaExceededError"===b&&d(b)}})["catch"](d)});return j(d,b),d}function e(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite").objectStore(d.storeName),f=e.clear();f.onsuccess=function(){a()},f.onerror=function(){c(f.error)}})["catch"](c)});return j(c,a),c}function f(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function g(a,b){var c=this,d=new l(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return i(d,b),d}function h(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function i(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}function j(a,b){b&&a.then(function(a){k(b,a)},function(a){b(a)})}function k(a,b){return a?setTimeout(function(){return a(null,b)},0):void 0}var l="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,m=m||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(m){var n={_driver:"asyncStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("asyncStorage",function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:this.asyncStorage=n}}).call(window),function(){"use strict";function a(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=c.name+"/",b._dbInfo=c,m.resolve()}function b(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo.keyPrefix,d=n.length-1;d>=0;d--){var e=n.key(d);0===e.indexOf(c)&&n.removeItem(e)}a()})["catch"](c)});return l(c,a),c}function c(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){try{var e=c._dbInfo,f=n.getItem(e.keyPrefix+a);f&&(f=h(f)),b(f)}catch(g){d(g)}})["catch"](d)});return l(d,b),d}function d(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var d,e=c._dbInfo;try{d=n.key(a)}catch(f){d=null}d&&(d=d.substring(e.keyPrefix.length)),b(d)})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo,d=n.length,e=[],f=0;d>f;f++)e.push(n.key(f).substring(c.keyPrefix.length));a(e)})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var b=n.length;a(b)})["catch"](c)});return l(c,a),c}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var d=c._dbInfo;n.removeItem(d.keyPrefix+a),b()})["catch"](d)});return l(d,b),d}function h(a){if(a.substring(0,q)!==p)return JSON.parse(a);for(var b=a.substring(C),c=a.substring(q,C),d=new ArrayBuffer(2*b.length),e=new Uint16Array(d),f=b.length-1;f>=0;f--)e[f]=b.charCodeAt(f);switch(c){case r:return d;case s:return new Blob([d]);case t:return new Int8Array(d);case u:return new Uint8Array(d);case v:return new Uint8ClampedArray(d);case w:return new Int16Array(d);case y:return new Uint16Array(d);case x:return new Int32Array(d);case z:return new Uint32Array(d);case A:return new Float32Array(d);case B:return new Float64Array(d);default:throw new Error("Unkown type: "+c)}}function i(a){var b="",c=new Uint16Array(a);try{b=String.fromCharCode.apply(null,c)}catch(d){for(var e=0;e<c.length;e++)b+=String.fromCharCode(c[e])}return b}function j(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(g)}}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;j(b,function(b,g){if(g)e(g);else{try{var h=d._dbInfo;n.setItem(h.keyPrefix+a,b)}catch(i){("QuotaExceededError"===i.name||"NS_ERROR_DOM_QUOTA_REACHED"===i.name)&&e(i)}c(f)}})})["catch"](e)});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,n=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;n=this.localStorage}catch(o){return}var p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length,D={_driver:"localStorageWrapper",_initStorage:a,getItem:c,setItem:k,removeItem:g,clear:b,length:f,key:d,keys:e};"function"==typeof define&&define.amd?define("localStorageWrapper",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.localStorageWrapper=D}.call(window),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];return new n(function(d,e){try{c.db=o(c.name,String(c.version),c.description,c.size)}catch(f){return b.setDriver("localStorageWrapper").then(function(){return b._initStorage(a)}).then(d)["catch"](e)}c.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=c,d()},function(a,b){e(b)})})})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=j(d)),b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new n(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;k(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})})["catch"](e)});return l(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function g(a,b){var c=this,d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function h(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=m[c[b]>>2],d+=m[(3&c[b])<<4|c[b+1]>>4],d+=m[(15&c[b+1])<<2|c[b+2]>>6],d+=m[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function j(a){if(a.substring(0,q)!==p)return JSON.parse(a);var b,c,d,e,f,g=a.substring(C),h=a.substring(q,C),i=.75*g.length,j=g.length,k=0;"="===g[g.length-1]&&(i--,"="===g[g.length-2]&&i--);var l=new ArrayBuffer(i),n=new Uint8Array(l);for(b=0;j>b;b+=4)c=m.indexOf(g[b]),d=m.indexOf(g[b+1]),e=m.indexOf(g[b+2]),f=m.indexOf(g[b+3]),n[k++]=c<<2|d>>4,n[k++]=(15&d)<<4|e>>2,n[k++]=(3&e)<<6|63&f;switch(h){case r:return l;case s:return new Blob([l]);case t:return new Int8Array(l);case u:return new Uint8Array(l);case v:return new Uint8ClampedArray(l);case w:return new Int16Array(l);case y:return new Uint16Array(l);case x:return new Int32Array(l);case z:return new Uint32Array(l);case A:return new Float32Array(l);case B:return new Float64Array(l);default:throw new Error("Unkown type: "+h)}}function k(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(null,g)}}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,o=this.openDatabase,p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length;if(o){var D={_driver:"webSQLStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("webSQLStorage",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.webSQLStorage=D}}.call(window),function(){"use strict";function a(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(arguments[0][c]=b[c])}return arguments[0]}function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function c(c){this._config=a({},i,c),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var d=0;d<g.length;d++)b(this,g[d]);this.setDriver(f)}var d="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},f=[e.INDEXEDDB,e.WEBSQL,e.LOCALSTORAGE],g=["clear","getItem","key","keys","length","removeItem","setItem"],h={DEFINE:1,EXPORT:2,WINDOW:3},i={description:"",name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},j=h.WINDOW;"function"==typeof define&&define.amd?j=h.DEFINE:"undefined"!=typeof module&&module.exports&&(j=h.EXPORT);var k=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[e.WEBSQL]=!!a.openDatabase,c[e.INDEXEDDB]=!!function(){try{return b&&"function"==typeof b.open&&null===b.open("_localforage_spec_test",1).onupgradeneeded}catch(a){return!1}}(),c[e.LOCALSTORAGE]=!!function(){try{return localStorage&&"function"==typeof localStorage.setItem}catch(a){return!1}}(),c}(this),l=this;c.prototype.INDEXEDDB=e.INDEXEDDB,c.prototype.LOCALSTORAGE=e.LOCALSTORAGE,c.prototype.WEBSQL=e.WEBSQL,c.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return!0}return"string"==typeof a?this._config[a]:this._config},c.prototype.driver=function(){return this._driver||null},c.prototype.ready=function(a){var b=this,c=new d(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)})["catch"](c)});return c.then(a,a),c},c.prototype.setDriver=function(a,b,c){var e=this;return"string"==typeof a&&(a=[a]),this._driverSet=new d(function(b,c){var f=e._getFirstSupportedDriver(a);if(!f){var g=new Error("No available storage method found.");return e._driverSet=d.reject(g),void c(g)}if(e._dbInfo=null,e._ready=null,j===h.DEFINE)return void require([f],function(a){e._extend(a),b()});if(j===h.EXPORT){var i;switch(f){case e.INDEXEDDB:i=require("./drivers/indexeddb");break;case e.LOCALSTORAGE:i=require("./drivers/localstorage");break;case e.WEBSQL:i=require("./drivers/websql")}e._extend(i)}else e._extend(l[f]);b()}),this._driverSet.then(b,c),this._driverSet},c.prototype.supports=function(a){return!!k[a]},c.prototype._extend=function(b){a(this,b)},c.prototype._getFirstSupportedDriver=function(a){var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};if(a&&b(a))for(var c=0;c<a.length;c++){var d=a[c];if(this.supports(d))return d}return null},c.prototype.createInstance=function(a){return new c(a)};var m=new c;j===h.DEFINE?define("localforage",function(){return m}):j===h.EXPORT?module.exports=m:this.localforage=m}.call(window); | ||
(function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new l(function(a,d){var e=m.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(){e.result.createObjectStore(c.storeName)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),b(a)},g.onerror=function(){d(g.error)}})["catch"](d)});return j(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new l(function(c,e){d.ready().then(function(){var f=d._dbInfo,g=f.db.transaction(f.storeName,"readwrite").objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);h.onsuccess=function(){void 0===b&&(b=null),c(b)},h.onerror=function(){e(h.error)}})["catch"](e)});return j(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite").objectStore(e.storeName),g=f["delete"](a);g.onsuccess=function(){b()},g.onerror=function(){d(g.error)},g.onabort=function(a){var b=a.target.error;"QuotaExceededError"===b&&d(b)}})["catch"](d)});return j(d,b),d}function e(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite").objectStore(d.storeName),f=e.clear();f.onsuccess=function(){a()},f.onerror=function(){c(f.error)}})["catch"](c)});return j(c,a),c}function f(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function g(a,b){var c=this,d=new l(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return i(d,b),d}function h(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function i(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}function j(a,b){b&&a.then(function(a){k(b,a)},function(a){b(a)})}function k(a,b){return a?setTimeout(function(){return a(null,b)},0):void 0}var l="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,m=m||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(m){var n={_driver:"asyncStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("asyncStorage",function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:this.asyncStorage=n}}).call(window),function(){"use strict";function a(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=c.name+"/",b._dbInfo=c,m.resolve()}function b(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo.keyPrefix,d=n.length-1;d>=0;d--){var e=n.key(d);0===e.indexOf(c)&&n.removeItem(e)}a()})["catch"](c)});return l(c,a),c}function c(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){try{var e=c._dbInfo,f=n.getItem(e.keyPrefix+a);f&&(f=h(f)),b(f)}catch(g){d(g)}})["catch"](d)});return l(d,b),d}function d(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var d,e=c._dbInfo;try{d=n.key(a)}catch(f){d=null}d&&(d=d.substring(e.keyPrefix.length)),b(d)})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo,d=n.length,e=[],f=0;d>f;f++)e.push(n.key(f).substring(c.keyPrefix.length));a(e)})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var b=n.length;a(b)})["catch"](c)});return l(c,a),c}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var d=c._dbInfo;n.removeItem(d.keyPrefix+a),b()})["catch"](d)});return l(d,b),d}function h(a){if(a.substring(0,q)!==p)return JSON.parse(a);for(var b=a.substring(C),c=a.substring(q,C),d=new ArrayBuffer(2*b.length),e=new Uint16Array(d),f=b.length-1;f>=0;f--)e[f]=b.charCodeAt(f);switch(c){case r:return d;case s:return new Blob([d]);case t:return new Int8Array(d);case u:return new Uint8Array(d);case v:return new Uint8ClampedArray(d);case w:return new Int16Array(d);case y:return new Uint16Array(d);case x:return new Int32Array(d);case z:return new Uint32Array(d);case A:return new Float32Array(d);case B:return new Float64Array(d);default:throw new Error("Unkown type: "+c)}}function i(a){var b="",c=new Uint16Array(a);try{b=String.fromCharCode.apply(null,c)}catch(d){for(var e=0;e<c.length;e++)b+=String.fromCharCode(c[e])}return b}function j(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(g)}}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;j(b,function(b,g){if(g)e(g);else{try{var h=d._dbInfo;n.setItem(h.keyPrefix+a,b)}catch(i){("QuotaExceededError"===i.name||"NS_ERROR_DOM_QUOTA_REACHED"===i.name)&&e(i)}c(f)}})})["catch"](e)});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,n=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;n=this.localStorage}catch(o){return}var p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length,D={_driver:"localStorageWrapper",_initStorage:a,getItem:c,setItem:k,removeItem:g,clear:b,length:f,key:d,keys:e};"function"==typeof define&&define.amd?define("localStorageWrapper",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.localStorageWrapper=D}.call(window),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];return new n(function(d,e){try{c.db=o(c.name,String(c.version),c.description,c.size)}catch(f){return b.setDriver("localStorageWrapper").then(function(){return b._initStorage(a)}).then(d)["catch"](e)}c.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=c,d()},function(a,b){e(b)})})})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=j(d)),b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new n(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;k(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})})["catch"](e)});return l(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function g(a,b){var c=this,d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function h(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=m[c[b]>>2],d+=m[(3&c[b])<<4|c[b+1]>>4],d+=m[(15&c[b+1])<<2|c[b+2]>>6],d+=m[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function j(a){if(a.substring(0,q)!==p)return JSON.parse(a);var b,c,d,e,f,g=a.substring(C),h=a.substring(q,C),i=.75*g.length,j=g.length,k=0;"="===g[g.length-1]&&(i--,"="===g[g.length-2]&&i--);var l=new ArrayBuffer(i),n=new Uint8Array(l);for(b=0;j>b;b+=4)c=m.indexOf(g[b]),d=m.indexOf(g[b+1]),e=m.indexOf(g[b+2]),f=m.indexOf(g[b+3]),n[k++]=c<<2|d>>4,n[k++]=(15&d)<<4|e>>2,n[k++]=(3&e)<<6|63&f;switch(h){case r:return l;case s:return new Blob([l]);case t:return new Int8Array(l);case u:return new Uint8Array(l);case v:return new Uint8ClampedArray(l);case w:return new Int16Array(l);case y:return new Uint16Array(l);case x:return new Int32Array(l);case z:return new Uint32Array(l);case A:return new Float32Array(l);case B:return new Float64Array(l);default:throw new Error("Unkown type: "+h)}}function k(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(null,g)}}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,o=this.openDatabase,p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length;if(o){var D={_driver:"webSQLStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("webSQLStorage",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.webSQLStorage=D}}.call(window),function(){"use strict";function a(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(arguments[0][c]=b[c])}return arguments[0]}function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function c(c){this._config=a({},i,c),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var d=0;d<g.length;d++)b(this,g[d]);this.setDriver(f)}var d="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},f=[e.INDEXEDDB,e.WEBSQL,e.LOCALSTORAGE],g=["clear","getItem","key","keys","length","removeItem","setItem"],h={DEFINE:1,EXPORT:2,WINDOW:3},i={description:"",name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},j=h.WINDOW;"function"==typeof define&&define.amd?j=h.DEFINE:"undefined"!=typeof module&&module.exports&&(j=h.EXPORT);var k=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[e.WEBSQL]=!!a.openDatabase,c[e.INDEXEDDB]=!!function(){if("undefined"!=typeof a.openDatabase&&a.navigator&&a.navigator.userAgent&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent))return!1;try{return b&&"function"==typeof b.open&&null===b.open("_localforage_spec_test",1).onupgradeneeded}catch(c){return!1}}(),c[e.LOCALSTORAGE]=!!function(){try{return localStorage&&"setItem"in localStorage&&localStorage.setItem}catch(a){return!1}}(),c}(this),l=this;c.prototype.INDEXEDDB=e.INDEXEDDB,c.prototype.LOCALSTORAGE=e.LOCALSTORAGE,c.prototype.WEBSQL=e.WEBSQL,c.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return!0}return"string"==typeof a?this._config[a]:this._config},c.prototype.driver=function(){return this._driver||null},c.prototype.ready=function(a){var b=this,c=new d(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)})["catch"](c)});return c.then(a,a),c},c.prototype.setDriver=function(a,b,c){var e=this;return"string"==typeof a&&(a=[a]),this._driverSet=new d(function(b,c){var f=e._getFirstSupportedDriver(a);if(!f){var g=new Error("No available storage method found.");return e._driverSet=d.reject(g),void c(g)}if(e._dbInfo=null,e._ready=null,j===h.DEFINE)return void require([f],function(a){e._extend(a),b()});if(j===h.EXPORT){var i;switch(f){case e.INDEXEDDB:i=require("./drivers/indexeddb");break;case e.LOCALSTORAGE:i=require("./drivers/localstorage");break;case e.WEBSQL:i=require("./drivers/websql")}e._extend(i)}else e._extend(l[f]);b()}),this._driverSet.then(b,c),this._driverSet},c.prototype.supports=function(a){return!!k[a]},c.prototype._extend=function(b){a(this,b)},c.prototype._getFirstSupportedDriver=function(a){var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};if(a&&b(a))for(var c=0;c<a.length;c++){var d=a[c];if(this.supports(d))return d}return null},c.prototype.createInstance=function(a){return new c(a)};var m=new c;j===h.DEFINE?define("localforage",function(){return m}):j===h.EXPORT?module.exports=m:this.localforage=m}.call(window); |
@@ -37,3 +37,3 @@ /* jshint node:true */ | ||
' localForage -- Offline Storage, Improved\n' + | ||
' Version 1.0.1\n' + | ||
' Version 1.0.2\n' + | ||
' http://mozilla.github.io/localForage\n' + | ||
@@ -40,0 +40,0 @@ ' (c) 2013-2014 Mozilla, Apache License 2.0\n' + |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/mozilla/localForage", | ||
@@ -14,0 +14,0 @@ "repository": { |
@@ -1,1 +0,1 @@ | ||
!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),a("promise/asap",["exports"],function(a){"use strict";function b(){return function(){process.nextTick(e)}}function c(){var a=0,b=new i(e),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function d(){return function(){j.setTimeout(e,1)}}function e(){for(var a=0;a<k.length;a++){var b=k[a],c=b[0],d=b[1];c(d)}k=[]}function f(a,b){var c=k.push([a,b]);1===c&&g()}var g,h="undefined"!=typeof window?window:{},i=h.MutationObserver||h.WebKitMutationObserver,j="undefined"!=typeof global?global:void 0===this?window:this,k=[];g="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():i?c():d(),a.asap=f}),a("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:void(c[a]=b)}var c={instrument:!1};a.config=c,a.configure=b}),a("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function d(){var a;a="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();b||(a.Promise=e)}var e=a.Promise,f=b.isFunction;c.polyfill=d}),a("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){if(!v(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],j(a,this)}function j(a,b){function c(a){o(b,a)}function d(a){q(b,a)}try{a(c,d)}catch(e){d(e)}}function k(a,b,c,d){var e,f,g,h,i=v(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;n(b,e)||(i&&g?o(b,e):h?q(b,f):a===D?o(b,e):a===E&&q(b,e))}function l(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+D]=c,e[f+E]=d}function m(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],k(b,c,d,f);a._subscribers=null}function n(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(u(b)&&(d=b.then,v(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?o(a,d):p(a,d)))},function(b){return c?!0:(c=!0,void q(a,b))}),!0}catch(e){return c?!0:(q(a,e),!0)}return!1}function o(a,b){a===b?p(a,b):n(a,b)||p(a,b)}function p(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(r,a))}function q(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(s,a))}function r(a){m(a,a._state=D)}function s(a){m(a,a._state=E)}var t=a.config,u=(a.configure,b.objectOrFunction),v=b.isFunction,w=(b.now,c.all),x=d.race,y=e.resolve,z=f.reject,A=g.asap;t.async=A;var B=void 0,C=0,D=1,E=2;i.prototype={constructor:i,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;t.async(function(){k(c._state,d,e[c._state-1],c._detail)})}else l(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},i.all=w,i.race=x,i.resolve=y,i.reject=z,h.Promise=i}),a("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),a("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),a("promise/resolve",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.resolve=b}),a("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),b("promise/polyfill").polyfill()}(),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new l(function(a,d){var e=m.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(){e.result.createObjectStore(c.storeName)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),b(a)},g.onerror=function(){d(g.error)}})["catch"](d)});return j(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new l(function(c,e){d.ready().then(function(){var f=d._dbInfo,g=f.db.transaction(f.storeName,"readwrite").objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);h.onsuccess=function(){void 0===b&&(b=null),c(b)},h.onerror=function(){e(h.error)}})["catch"](e)});return j(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite").objectStore(e.storeName),g=f["delete"](a);g.onsuccess=function(){b()},g.onerror=function(){d(g.error)},g.onabort=function(a){var b=a.target.error;"QuotaExceededError"===b&&d(b)}})["catch"](d)});return j(d,b),d}function e(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite").objectStore(d.storeName),f=e.clear();f.onsuccess=function(){a()},f.onerror=function(){c(f.error)}})["catch"](c)});return j(c,a),c}function f(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function g(a,b){var c=this,d=new l(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return i(d,b),d}function h(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function i(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}function j(a,b){b&&a.then(function(a){k(b,a)},function(a){b(a)})}function k(a,b){return a?setTimeout(function(){return a(null,b)},0):void 0}var l="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,m=m||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(m){var n={_driver:"asyncStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("asyncStorage",function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:this.asyncStorage=n}}.call(window),function(){"use strict";function a(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=c.name+"/",b._dbInfo=c,m.resolve()}function b(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo.keyPrefix,d=n.length-1;d>=0;d--){var e=n.key(d);0===e.indexOf(c)&&n.removeItem(e)}a()})["catch"](c)});return l(c,a),c}function c(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){try{var e=c._dbInfo,f=n.getItem(e.keyPrefix+a);f&&(f=h(f)),b(f)}catch(g){d(g)}})["catch"](d)});return l(d,b),d}function d(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var d,e=c._dbInfo;try{d=n.key(a)}catch(f){d=null}d&&(d=d.substring(e.keyPrefix.length)),b(d)})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo,d=n.length,e=[],f=0;d>f;f++)e.push(n.key(f).substring(c.keyPrefix.length));a(e)})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var b=n.length;a(b)})["catch"](c)});return l(c,a),c}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var d=c._dbInfo;n.removeItem(d.keyPrefix+a),b()})["catch"](d)});return l(d,b),d}function h(a){if(a.substring(0,q)!==p)return JSON.parse(a);for(var b=a.substring(C),c=a.substring(q,C),d=new ArrayBuffer(2*b.length),e=new Uint16Array(d),f=b.length-1;f>=0;f--)e[f]=b.charCodeAt(f);switch(c){case r:return d;case s:return new Blob([d]);case t:return new Int8Array(d);case u:return new Uint8Array(d);case v:return new Uint8ClampedArray(d);case w:return new Int16Array(d);case y:return new Uint16Array(d);case x:return new Int32Array(d);case z:return new Uint32Array(d);case A:return new Float32Array(d);case B:return new Float64Array(d);default:throw new Error("Unkown type: "+c)}}function i(a){var b="",c=new Uint16Array(a);try{b=String.fromCharCode.apply(null,c)}catch(d){for(var e=0;e<c.length;e++)b+=String.fromCharCode(c[e])}return b}function j(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(g)}}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;j(b,function(b,g){if(g)e(g);else{try{var h=d._dbInfo;n.setItem(h.keyPrefix+a,b)}catch(i){("QuotaExceededError"===i.name||"NS_ERROR_DOM_QUOTA_REACHED"===i.name)&&e(i)}c(f)}})})["catch"](e)});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,n=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;n=this.localStorage}catch(o){return}var p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length,D={_driver:"localStorageWrapper",_initStorage:a,getItem:c,setItem:k,removeItem:g,clear:b,length:f,key:d,keys:e};"function"==typeof define&&define.amd?define("localStorageWrapper",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.localStorageWrapper=D}.call(window),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];return new n(function(d,e){try{c.db=o(c.name,String(c.version),c.description,c.size)}catch(f){return b.setDriver("localStorageWrapper").then(function(){return b._initStorage(a)}).then(d)["catch"](e)}c.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=c,d()},function(a,b){e(b)})})})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=j(d)),b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new n(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;k(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})})["catch"](e)});return l(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function g(a,b){var c=this,d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function h(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=m[c[b]>>2],d+=m[(3&c[b])<<4|c[b+1]>>4],d+=m[(15&c[b+1])<<2|c[b+2]>>6],d+=m[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function j(a){if(a.substring(0,q)!==p)return JSON.parse(a);var b,c,d,e,f,g=a.substring(C),h=a.substring(q,C),i=.75*g.length,j=g.length,k=0;"="===g[g.length-1]&&(i--,"="===g[g.length-2]&&i--);var l=new ArrayBuffer(i),n=new Uint8Array(l);for(b=0;j>b;b+=4)c=m.indexOf(g[b]),d=m.indexOf(g[b+1]),e=m.indexOf(g[b+2]),f=m.indexOf(g[b+3]),n[k++]=c<<2|d>>4,n[k++]=(15&d)<<4|e>>2,n[k++]=(3&e)<<6|63&f;switch(h){case r:return l;case s:return new Blob([l]);case t:return new Int8Array(l);case u:return new Uint8Array(l);case v:return new Uint8ClampedArray(l);case w:return new Int16Array(l);case y:return new Uint16Array(l);case x:return new Int32Array(l);case z:return new Uint32Array(l);case A:return new Float32Array(l);case B:return new Float64Array(l);default:throw new Error("Unkown type: "+h)}}function k(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(null,g)}}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,o=this.openDatabase,p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length;if(o){var D={_driver:"webSQLStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("webSQLStorage",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.webSQLStorage=D}}.call(window),function(){"use strict";function a(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(arguments[0][c]=b[c])}return arguments[0]}function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function c(c){this._config=a({},i,c),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var d=0;d<g.length;d++)b(this,g[d]);this.setDriver(f)}var d="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},f=[e.INDEXEDDB,e.WEBSQL,e.LOCALSTORAGE],g=["clear","getItem","key","keys","length","removeItem","setItem"],h={DEFINE:1,EXPORT:2,WINDOW:3},i={description:"",name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},j=h.WINDOW;"function"==typeof define&&define.amd?j=h.DEFINE:"undefined"!=typeof module&&module.exports&&(j=h.EXPORT);var k=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[e.WEBSQL]=!!a.openDatabase,c[e.INDEXEDDB]=!!function(){try{return b&&"function"==typeof b.open&&null===b.open("_localforage_spec_test",1).onupgradeneeded}catch(a){return!1}}(),c[e.LOCALSTORAGE]=!!function(){try{return localStorage&&"function"==typeof localStorage.setItem}catch(a){return!1}}(),c}(this),l=this;c.prototype.INDEXEDDB=e.INDEXEDDB,c.prototype.LOCALSTORAGE=e.LOCALSTORAGE,c.prototype.WEBSQL=e.WEBSQL,c.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return!0}return"string"==typeof a?this._config[a]:this._config},c.prototype.driver=function(){return this._driver||null},c.prototype.ready=function(a){var b=this,c=new d(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)})["catch"](c)});return c.then(a,a),c},c.prototype.setDriver=function(a,b,c){var e=this;return"string"==typeof a&&(a=[a]),this._driverSet=new d(function(b,c){var f=e._getFirstSupportedDriver(a);if(!f){var g=new Error("No available storage method found.");return e._driverSet=d.reject(g),void c(g)}if(e._dbInfo=null,e._ready=null,j===h.DEFINE)return void require([f],function(a){e._extend(a),b()});if(j===h.EXPORT){var i;switch(f){case e.INDEXEDDB:i=require("./drivers/indexeddb");break;case e.LOCALSTORAGE:i=require("./drivers/localstorage");break;case e.WEBSQL:i=require("./drivers/websql")}e._extend(i)}else e._extend(l[f]);b()}),this._driverSet.then(b,c),this._driverSet},c.prototype.supports=function(a){return!!k[a]},c.prototype._extend=function(b){a(this,b)},c.prototype._getFirstSupportedDriver=function(a){var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};if(a&&b(a))for(var c=0;c<a.length;c++){var d=a[c];if(this.supports(d))return d}return null},c.prototype.createInstance=function(a){return new c(a)};var m=new c;j===h.DEFINE?define("localforage",function(){return m}):j===h.EXPORT?module.exports=m:this.localforage=m}.call(window); | ||
!function(){var a,b,c,d;!function(){var e={},f={};a=function(a,b,c){e[a]={deps:b,callback:c}},d=c=b=function(a){function c(b){if("."!==b.charAt(0))return b;for(var c=b.split("/"),d=a.split("/").slice(0,-1),e=0,f=c.length;f>e;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)k.push("exports"===i[l]?g={}:b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j<a.length;j++)g=a[j],g&&e(g.then)?g.then(d(j),c):f(j,g)})}var d=a.isArray,e=a.isFunction;b.all=c}),a("promise/asap",["exports"],function(a){"use strict";function b(){return function(){process.nextTick(e)}}function c(){var a=0,b=new i(e),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function d(){return function(){j.setTimeout(e,1)}}function e(){for(var a=0;a<k.length;a++){var b=k[a],c=b[0],d=b[1];c(d)}k=[]}function f(a,b){var c=k.push([a,b]);1===c&&g()}var g,h="undefined"!=typeof window?window:{},i=h.MutationObserver||h.WebKitMutationObserver,j="undefined"!=typeof global?global:void 0===this?window:this,k=[];g="undefined"!=typeof process&&"[object process]"==={}.toString.call(process)?b():i?c():d(),a.asap=f}),a("promise/config",["exports"],function(a){"use strict";function b(a,b){return 2!==arguments.length?c[a]:void(c[a]=b)}var c={instrument:!1};a.config=c,a.configure=b}),a("promise/polyfill",["./promise","./utils","exports"],function(a,b,c){"use strict";function d(){var a;a="undefined"!=typeof global?global:"undefined"!=typeof window&&window.document?window:self;var b="Promise"in a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;return new a.Promise(function(a){b=a}),f(b)}();b||(a.Promise=e)}var e=a.Promise,f=b.isFunction;c.polyfill=d}),a("promise/promise",["./config","./utils","./all","./race","./resolve","./reject","./asap","exports"],function(a,b,c,d,e,f,g,h){"use strict";function i(a){if(!v(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof i))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");this._subscribers=[],j(a,this)}function j(a,b){function c(a){o(b,a)}function d(a){q(b,a)}try{a(c,d)}catch(e){d(e)}}function k(a,b,c,d){var e,f,g,h,i=v(c);if(i)try{e=c(d),g=!0}catch(j){h=!0,f=j}else e=d,g=!0;n(b,e)||(i&&g?o(b,e):h?q(b,f):a===D?o(b,e):a===E&&q(b,e))}function l(a,b,c,d){var e=a._subscribers,f=e.length;e[f]=b,e[f+D]=c,e[f+E]=d}function m(a,b){for(var c,d,e=a._subscribers,f=a._detail,g=0;g<e.length;g+=3)c=e[g],d=e[g+b],k(b,c,d,f);a._subscribers=null}function n(a,b){var c,d=null;try{if(a===b)throw new TypeError("A promises callback cannot return that same promise.");if(u(b)&&(d=b.then,v(d)))return d.call(b,function(d){return c?!0:(c=!0,void(b!==d?o(a,d):p(a,d)))},function(b){return c?!0:(c=!0,void q(a,b))}),!0}catch(e){return c?!0:(q(a,e),!0)}return!1}function o(a,b){a===b?p(a,b):n(a,b)||p(a,b)}function p(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(r,a))}function q(a,b){a._state===B&&(a._state=C,a._detail=b,t.async(s,a))}function r(a){m(a,a._state=D)}function s(a){m(a,a._state=E)}var t=a.config,u=(a.configure,b.objectOrFunction),v=b.isFunction,w=(b.now,c.all),x=d.race,y=e.resolve,z=f.reject,A=g.asap;t.async=A;var B=void 0,C=0,D=1,E=2;i.prototype={constructor:i,_state:void 0,_detail:void 0,_subscribers:void 0,then:function(a,b){var c=this,d=new this.constructor(function(){});if(this._state){var e=arguments;t.async(function(){k(c._state,d,e[c._state-1],c._detail)})}else l(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}},i.all=w,i.race=x,i.resolve=y,i.reject=z,h.Promise=i}),a("promise/race",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to race.");return new b(function(b,c){for(var d,e=0;e<a.length;e++)d=a[e],d&&"function"==typeof d.then?d.then(b,c):b(d)})}var d=a.isArray;b.race=c}),a("promise/reject",["exports"],function(a){"use strict";function b(a){var b=this;return new b(function(b,c){c(a)})}a.reject=b}),a("promise/resolve",["exports"],function(a){"use strict";function b(a){if(a&&"object"==typeof a&&a.constructor===this)return a;var b=this;return new b(function(b){b(a)})}a.resolve=b}),a("promise/utils",["exports"],function(a){"use strict";function b(a){return c(a)||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}var e=Date.now||function(){return(new Date).getTime()};a.objectOrFunction=b,a.isFunction=c,a.isArray=d,a.now=e}),b("promise/polyfill").polyfill()}(),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]=a[d];return new l(function(a,d){var e=m.open(c.name,c.version);e.onerror=function(){d(e.error)},e.onupgradeneeded=function(){e.result.createObjectStore(c.storeName)},e.onsuccess=function(){c.db=e.result,b._dbInfo=c,a()}})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=f.get(a);g.onsuccess=function(){var a=g.result;void 0===a&&(a=null),b(a)},g.onerror=function(){d(g.error)}})["catch"](d)});return j(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new l(function(c,e){d.ready().then(function(){var f=d._dbInfo,g=f.db.transaction(f.storeName,"readwrite").objectStore(f.storeName);null===b&&(b=void 0);var h=g.put(b,a);h.onsuccess=function(){void 0===b&&(b=null),c(b)},h.onerror=function(){e(h.error)}})["catch"](e)});return j(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new l(function(b,d){c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readwrite").objectStore(e.storeName),g=f["delete"](a);g.onsuccess=function(){b()},g.onerror=function(){d(g.error)},g.onabort=function(a){var b=a.target.error;"QuotaExceededError"===b&&d(b)}})["catch"](d)});return j(d,b),d}function e(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readwrite").objectStore(d.storeName),f=e.clear();f.onsuccess=function(){a()},f.onerror=function(){c(f.error)}})["catch"](c)});return j(c,a),c}function f(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.count();f.onsuccess=function(){a(f.result)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function g(a,b){var c=this,d=new l(function(b,d){return 0>a?void b(null):void c.ready().then(function(){var e=c._dbInfo,f=e.db.transaction(e.storeName,"readonly").objectStore(e.storeName),g=!1,h=f.openCursor();h.onsuccess=function(){var c=h.result;return c?void(0===a?b(c.key):g?b(c.key):(g=!0,c.advance(a))):void b(null)},h.onerror=function(){d(h.error)}})["catch"](d)});return i(d,b),d}function h(a){var b=this,c=new l(function(a,c){b.ready().then(function(){var d=b._dbInfo,e=d.db.transaction(d.storeName,"readonly").objectStore(d.storeName),f=e.openCursor(),g=[];f.onsuccess=function(){var b=f.result;return b?(g.push(b.key),void b["continue"]()):void a(g)},f.onerror=function(){c(f.error)}})["catch"](c)});return i(c,a),c}function i(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}function j(a,b){b&&a.then(function(a){k(b,a)},function(a){b(a)})}function k(a,b){return a?setTimeout(function(){return a(null,b)},0):void 0}var l="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,m=m||this.indexedDB||this.webkitIndexedDB||this.mozIndexedDB||this.OIndexedDB||this.msIndexedDB;if(m){var n={_driver:"asyncStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("asyncStorage",function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:this.asyncStorage=n}}.call(window),function(){"use strict";function a(a){var b=this,c={};if(a)for(var d in a)c[d]=a[d];return c.keyPrefix=c.name+"/",b._dbInfo=c,m.resolve()}function b(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo.keyPrefix,d=n.length-1;d>=0;d--){var e=n.key(d);0===e.indexOf(c)&&n.removeItem(e)}a()})["catch"](c)});return l(c,a),c}function c(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){try{var e=c._dbInfo,f=n.getItem(e.keyPrefix+a);f&&(f=h(f)),b(f)}catch(g){d(g)}})["catch"](d)});return l(d,b),d}function d(a,b){var c=this,d=new m(function(b,d){c.ready().then(function(){var d,e=c._dbInfo;try{d=n.key(a)}catch(f){d=null}d&&(d=d.substring(e.keyPrefix.length)),b(d)})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new m(function(a,c){b.ready().then(function(){for(var c=b._dbInfo,d=n.length,e=[],f=0;d>f;f++)e.push(n.key(f).substring(c.keyPrefix.length));a(e)})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new m(function(a,c){b.ready().then(function(){var b=n.length;a(b)})["catch"](c)});return l(c,a),c}function g(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new m(function(b,d){c.ready().then(function(){var d=c._dbInfo;n.removeItem(d.keyPrefix+a),b()})["catch"](d)});return l(d,b),d}function h(a){if(a.substring(0,q)!==p)return JSON.parse(a);for(var b=a.substring(C),c=a.substring(q,C),d=new ArrayBuffer(2*b.length),e=new Uint16Array(d),f=b.length-1;f>=0;f--)e[f]=b.charCodeAt(f);switch(c){case r:return d;case s:return new Blob([d]);case t:return new Int8Array(d);case u:return new Uint8Array(d);case v:return new Uint8ClampedArray(d);case w:return new Int16Array(d);case y:return new Uint16Array(d);case x:return new Int32Array(d);case z:return new Uint32Array(d);case A:return new Float32Array(d);case B:return new Float64Array(d);default:throw new Error("Unkown type: "+c)}}function i(a){var b="",c=new Uint16Array(a);try{b=String.fromCharCode.apply(null,c)}catch(d){for(var e=0;e<c.length;e++)b+=String.fromCharCode(c[e])}return b}function j(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(g)}}function k(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new m(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;j(b,function(b,g){if(g)e(g);else{try{var h=d._dbInfo;n.setItem(h.keyPrefix+a,b)}catch(i){("QuotaExceededError"===i.name||"NS_ERROR_DOM_QUOTA_REACHED"===i.name)&&e(i)}c(f)}})})["catch"](e)});return l(e,c),e}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,n=null;try{if(!(this.localStorage&&"setItem"in this.localStorage))return;n=this.localStorage}catch(o){return}var p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length,D={_driver:"localStorageWrapper",_initStorage:a,getItem:c,setItem:k,removeItem:g,clear:b,length:f,key:d,keys:e};"function"==typeof define&&define.amd?define("localStorageWrapper",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.localStorageWrapper=D}.call(window),function(){"use strict";function a(a){var b=this,c={db:null};if(a)for(var d in a)c[d]="string"!=typeof a[d]?a[d].toString():a[d];return new n(function(d,e){try{c.db=o(c.name,String(c.version),c.description,c.size)}catch(f){return b.setDriver("localStorageWrapper").then(function(){return b._initStorage(a)}).then(d)["catch"](e)}c.db.transaction(function(a){a.executeSql("CREATE TABLE IF NOT EXISTS "+c.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],function(){b._dbInfo=c,d()},function(a,b){e(b)})})})}function b(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT * FROM "+e.storeName+" WHERE key = ? LIMIT 1",[a],function(a,c){var d=c.rows.length?c.rows.item(0).value:null;d&&(d=j(d)),b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function c(a,b,c){var d=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var e=new n(function(c,e){d.ready().then(function(){void 0===b&&(b=null);var f=b;k(b,function(b,g){if(g)e(g);else{var h=d._dbInfo;h.db.transaction(function(d){d.executeSql("INSERT OR REPLACE INTO "+h.storeName+" (key, value) VALUES (?, ?)",[a,b],function(){c(f)},function(a,b){e(b)})},function(a){a.code===a.QUOTA_ERR&&e(a)})}})})["catch"](e)});return l(e,c),e}function d(a,b){var c=this;"string"!=typeof a&&(window.console.warn(a+" used as a key, but it is not a string."),a=String(a));var d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("DELETE FROM "+e.storeName+" WHERE key = ?",[a],function(){b()},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function e(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("DELETE FROM "+d.storeName,[],function(){a()},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function f(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT COUNT(key) as c FROM "+d.storeName,[],function(b,c){var d=c.rows.item(0).c;a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function g(a,b){var c=this,d=new n(function(b,d){c.ready().then(function(){var e=c._dbInfo;e.db.transaction(function(c){c.executeSql("SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[a+1],function(a,c){var d=c.rows.length?c.rows.item(0).key:null;b(d)},function(a,b){d(b)})})})["catch"](d)});return l(d,b),d}function h(a){var b=this,c=new n(function(a,c){b.ready().then(function(){var d=b._dbInfo;d.db.transaction(function(b){b.executeSql("SELECT key FROM "+d.storeName,[],function(b,c){for(var d=[],e=0;e<c.rows.length;e++)d.push(c.rows.item(e).key);a(d)},function(a,b){c(b)})})})["catch"](c)});return l(c,a),c}function i(a){var b,c=new Uint8Array(a),d="";for(b=0;b<c.length;b+=3)d+=m[c[b]>>2],d+=m[(3&c[b])<<4|c[b+1]>>4],d+=m[(15&c[b+1])<<2|c[b+2]>>6],d+=m[63&c[b+2]];return c.length%3===2?d=d.substring(0,d.length-1)+"=":c.length%3===1&&(d=d.substring(0,d.length-2)+"=="),d}function j(a){if(a.substring(0,q)!==p)return JSON.parse(a);var b,c,d,e,f,g=a.substring(C),h=a.substring(q,C),i=.75*g.length,j=g.length,k=0;"="===g[g.length-1]&&(i--,"="===g[g.length-2]&&i--);var l=new ArrayBuffer(i),n=new Uint8Array(l);for(b=0;j>b;b+=4)c=m.indexOf(g[b]),d=m.indexOf(g[b+1]),e=m.indexOf(g[b+2]),f=m.indexOf(g[b+3]),n[k++]=c<<2|d>>4,n[k++]=(15&d)<<4|e>>2,n[k++]=(3&e)<<6|63&f;switch(h){case r:return l;case s:return new Blob([l]);case t:return new Int8Array(l);case u:return new Uint8Array(l);case v:return new Uint8ClampedArray(l);case w:return new Int16Array(l);case y:return new Uint16Array(l);case x:return new Int32Array(l);case z:return new Uint32Array(l);case A:return new Float32Array(l);case B:return new Float64Array(l);default:throw new Error("Unkown type: "+h)}}function k(a,b){var c="";if(a&&(c=a.toString()),a&&("[object ArrayBuffer]"===a.toString()||a.buffer&&"[object ArrayBuffer]"===a.buffer.toString())){var d,e=p;a instanceof ArrayBuffer?(d=a,e+=r):(d=a.buffer,"[object Int8Array]"===c?e+=t:"[object Uint8Array]"===c?e+=u:"[object Uint8ClampedArray]"===c?e+=v:"[object Int16Array]"===c?e+=w:"[object Uint16Array]"===c?e+=y:"[object Int32Array]"===c?e+=x:"[object Uint32Array]"===c?e+=z:"[object Float32Array]"===c?e+=A:"[object Float64Array]"===c?e+=B:b(new Error("Failed to get type for BinaryArray"))),b(e+i(d))}else if("[object Blob]"===c){var f=new FileReader;f.onload=function(){var a=i(this.result);b(p+s+a)},f.readAsArrayBuffer(a)}else try{b(JSON.stringify(a))}catch(g){window.console.error("Couldn't convert value into a JSON string: ",a),b(null,g)}}function l(a,b){b&&a.then(function(a){b(null,a)},function(a){b(a)})}var m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,o=this.openDatabase,p="__lfsc__:",q=p.length,r="arbf",s="blob",t="si08",u="ui08",v="uic8",w="si16",x="si32",y="ur16",z="ui32",A="fl32",B="fl64",C=q+r.length;if(o){var D={_driver:"webSQLStorage",_initStorage:a,getItem:b,setItem:c,removeItem:d,clear:e,length:f,key:g,keys:h};"function"==typeof define&&define.amd?define("webSQLStorage",function(){return D}):"undefined"!=typeof module&&module.exports?module.exports=D:this.webSQLStorage=D}}.call(window),function(){"use strict";function a(){for(var a=1;a<arguments.length;a++){var b=arguments[a];if(b)for(var c in b)b.hasOwnProperty(c)&&(arguments[0][c]=b[c])}return arguments[0]}function b(a,b){a[b]=function(){var c=arguments;return a.ready().then(function(){return a[b].apply(a,c)})}}function c(c){this._config=a({},i,c),this._driverSet=null,this._ready=!1,this._dbInfo=null;for(var d=0;d<g.length;d++)b(this,g[d]);this.setDriver(f)}var d="undefined"!=typeof module&&module.exports?require("promise"):this.Promise,e={INDEXEDDB:"asyncStorage",LOCALSTORAGE:"localStorageWrapper",WEBSQL:"webSQLStorage"},f=[e.INDEXEDDB,e.WEBSQL,e.LOCALSTORAGE],g=["clear","getItem","key","keys","length","removeItem","setItem"],h={DEFINE:1,EXPORT:2,WINDOW:3},i={description:"",name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1},j=h.WINDOW;"function"==typeof define&&define.amd?j=h.DEFINE:"undefined"!=typeof module&&module.exports&&(j=h.EXPORT);var k=function(a){var b=b||a.indexedDB||a.webkitIndexedDB||a.mozIndexedDB||a.OIndexedDB||a.msIndexedDB,c={};return c[e.WEBSQL]=!!a.openDatabase,c[e.INDEXEDDB]=!!function(){if("undefined"!=typeof a.openDatabase&&a.navigator&&a.navigator.userAgent&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent))return!1;try{return b&&"function"==typeof b.open&&null===b.open("_localforage_spec_test",1).onupgradeneeded}catch(c){return!1}}(),c[e.LOCALSTORAGE]=!!function(){try{return localStorage&&"setItem"in localStorage&&localStorage.setItem}catch(a){return!1}}(),c}(this),l=this;c.prototype.INDEXEDDB=e.INDEXEDDB,c.prototype.LOCALSTORAGE=e.LOCALSTORAGE,c.prototype.WEBSQL=e.WEBSQL,c.prototype.config=function(a){if("object"==typeof a){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var b in a)"storeName"===b&&(a[b]=a[b].replace(/\W/g,"_")),this._config[b]=a[b];return!0}return"string"==typeof a?this._config[a]:this._config},c.prototype.driver=function(){return this._driver||null},c.prototype.ready=function(a){var b=this,c=new d(function(a,c){b._driverSet.then(function(){null===b._ready&&(b._ready=b._initStorage(b._config)),b._ready.then(a,c)})["catch"](c)});return c.then(a,a),c},c.prototype.setDriver=function(a,b,c){var e=this;return"string"==typeof a&&(a=[a]),this._driverSet=new d(function(b,c){var f=e._getFirstSupportedDriver(a);if(!f){var g=new Error("No available storage method found.");return e._driverSet=d.reject(g),void c(g)}if(e._dbInfo=null,e._ready=null,j===h.DEFINE)return void require([f],function(a){e._extend(a),b()});if(j===h.EXPORT){var i;switch(f){case e.INDEXEDDB:i=require("./drivers/indexeddb");break;case e.LOCALSTORAGE:i=require("./drivers/localstorage");break;case e.WEBSQL:i=require("./drivers/websql")}e._extend(i)}else e._extend(l[f]);b()}),this._driverSet.then(b,c),this._driverSet},c.prototype.supports=function(a){return!!k[a]},c.prototype._extend=function(b){a(this,b)},c.prototype._getFirstSupportedDriver=function(a){var b=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};if(a&&b(a))for(var c=0;c<a.length;c++){var d=a[c];if(this.supports(d))return d}return null},c.prototype.createInstance=function(a){return new c(a)};var m=new c;j===h.DEFINE?define("localforage",function(){return m}):j===h.EXPORT?module.exports=m:this.localforage=m}.call(window); |
@@ -25,3 +25,3 @@ // Some code originally from async_storage.js in | ||
function _initStorage(options) { | ||
var _this = this; | ||
var self = this; | ||
var dbInfo = { | ||
@@ -48,3 +48,3 @@ db: null | ||
dbInfo.db = openreq.result; | ||
_this._dbInfo = dbInfo; | ||
self._dbInfo = dbInfo; | ||
resolve(); | ||
@@ -56,3 +56,3 @@ }; | ||
function getItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -67,4 +67,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -94,3 +94,3 @@ .objectStore(dbInfo.storeName); | ||
function setItem(key, value, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -105,4 +105,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readwrite') | ||
@@ -144,3 +144,3 @@ .objectStore(dbInfo.storeName); | ||
function removeItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -155,4 +155,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readwrite') | ||
@@ -192,7 +192,7 @@ .objectStore(dbInfo.storeName); | ||
function clear(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readwrite') | ||
@@ -217,7 +217,7 @@ .objectStore(dbInfo.storeName); | ||
function length(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -242,3 +242,3 @@ .objectStore(dbInfo.storeName); | ||
function key(n, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -252,4 +252,4 @@ var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -297,7 +297,7 @@ .objectStore(dbInfo.storeName); | ||
function keys(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') | ||
@@ -304,0 +304,0 @@ .objectStore(dbInfo.storeName); |
@@ -33,3 +33,3 @@ // If IndexedDB isn't available, we'll fall back to localStorage. | ||
function _initStorage(options) { | ||
var _this = this; | ||
var self = this; | ||
var dbInfo = {}; | ||
@@ -44,3 +44,3 @@ if (options) { | ||
_this._dbInfo = dbInfo; | ||
self._dbInfo = dbInfo; | ||
return Promise.resolve(); | ||
@@ -70,6 +70,6 @@ } | ||
function clear(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var keyPrefix = _this._dbInfo.keyPrefix; | ||
self.ready().then(function() { | ||
var keyPrefix = self._dbInfo.keyPrefix; | ||
@@ -96,3 +96,3 @@ for (var i = localStorage.length - 1; i >= 0; i--) { | ||
function getItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -107,5 +107,5 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
try { | ||
var dbInfo = _this._dbInfo; | ||
var dbInfo = self._dbInfo; | ||
var result = localStorage.getItem(dbInfo.keyPrefix + key); | ||
@@ -134,6 +134,6 @@ | ||
function key(n, callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var result; | ||
@@ -160,6 +160,6 @@ try { | ||
function keys(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
var length = localStorage.length; | ||
@@ -183,5 +183,5 @@ var keys = []; | ||
function length(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
var result = localStorage.length; | ||
@@ -199,3 +199,3 @@ | ||
function removeItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -210,4 +210,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
localStorage.removeItem(dbInfo.keyPrefix + key); | ||
@@ -383,3 +383,3 @@ | ||
function setItem(key, value, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -394,3 +394,3 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
// Convert undefined values to null. | ||
@@ -410,3 +410,3 @@ // https://github.com/mozilla/localForage/pull/42 | ||
try { | ||
var dbInfo = _this._dbInfo; | ||
var dbInfo = self._dbInfo; | ||
localStorage.setItem(dbInfo.keyPrefix + key, value); | ||
@@ -413,0 +413,0 @@ } catch (e) { |
@@ -50,3 +50,3 @@ /* | ||
function _initStorage(options) { | ||
var _this = this; | ||
var self = this; | ||
var dbInfo = { | ||
@@ -70,5 +70,5 @@ db: null | ||
} catch (e) { | ||
return _this.setDriver('localStorageWrapper') | ||
return self.setDriver('localStorageWrapper') | ||
.then(function() { | ||
return _this._initStorage(options); | ||
return self._initStorage(options); | ||
}) | ||
@@ -84,3 +84,3 @@ .then(resolve) | ||
function() { | ||
_this._dbInfo = dbInfo; | ||
self._dbInfo = dbInfo; | ||
resolve(); | ||
@@ -95,3 +95,3 @@ }, function(t, error) { | ||
function getItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -106,4 +106,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -136,3 +136,3 @@ t.executeSql('SELECT * FROM ' + dbInfo.storeName + | ||
function setItem(key, value, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -147,3 +147,3 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
self.ready().then(function() { | ||
// The localStorage API doesn't return undefined values in an | ||
@@ -163,3 +163,3 @@ // "expected" way, so undefined is always cast to null in all | ||
} else { | ||
var dbInfo = _this._dbInfo; | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -197,3 +197,3 @@ t.executeSql('INSERT OR REPLACE INTO ' + | ||
function removeItem(key, callback) { | ||
var _this = this; | ||
var self = this; | ||
@@ -208,4 +208,4 @@ // Cast the key to a string, as that's all we can set as a key. | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -231,7 +231,7 @@ t.executeSql('DELETE FROM ' + dbInfo.storeName + | ||
function clear(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -255,7 +255,7 @@ t.executeSql('DELETE FROM ' + dbInfo.storeName, [], | ||
function length(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -288,7 +288,7 @@ // Ahhh, SQL makes this one soooooo easy. | ||
function key(n, callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -313,7 +313,7 @@ t.executeSql('SELECT key FROM ' + dbInfo.storeName + | ||
function keys(callback) { | ||
var _this = this; | ||
var self = this; | ||
var promise = new Promise(function(resolve, reject) { | ||
_this.ready().then(function() { | ||
var dbInfo = _this._dbInfo; | ||
self.ready().then(function() { | ||
var dbInfo = self._dbInfo; | ||
dbInfo.db.transaction(function(t) { | ||
@@ -320,0 +320,0 @@ t.executeSql('SELECT key FROM ' + dbInfo.storeName, [], |
@@ -63,13 +63,28 @@ (function() { | ||
// See: https://github.com/mozilla/localForage/issues/128 | ||
var driverSupport = (function(_this) { | ||
var driverSupport = (function(self) { | ||
// Initialize IndexedDB; fall back to vendor-prefixed versions | ||
// if needed. | ||
var indexedDB = indexedDB || _this.indexedDB || _this.webkitIndexedDB || | ||
_this.mozIndexedDB || _this.OIndexedDB || | ||
_this.msIndexedDB; | ||
var indexedDB = indexedDB || self.indexedDB || self.webkitIndexedDB || | ||
self.mozIndexedDB || self.OIndexedDB || | ||
self.msIndexedDB; | ||
var result = {}; | ||
result[DriverType.WEBSQL] = !!_this.openDatabase; | ||
result[DriverType.WEBSQL] = !!self.openDatabase; | ||
result[DriverType.INDEXEDDB] = !!(function() { | ||
// We mimic PouchDB here; just UA test for Safari (which, as of | ||
// iOS 8/Yosemite, doesn't properly support IndexedDB). | ||
// IndexedDB support is broken and different from Blink's. | ||
// This is faster than the test case (and it's sync), so we just | ||
// do this. *SIGH* | ||
// http://bl.ocks.org/nolanlawson/raw/c83e9039edf2278047e9/ | ||
// | ||
// We test for openDatabase because IE Mobile identifies itself | ||
// as Safari. Oh the lulz... | ||
if (typeof self.openDatabase !== 'undefined' && self.navigator && | ||
self.navigator.userAgent && | ||
/Safari/.test(navigator.userAgent) && | ||
!/Chrome/.test(navigator.userAgent)) { | ||
return false; | ||
} | ||
try { | ||
@@ -88,3 +103,4 @@ return (indexedDB && | ||
return (localStorage && | ||
typeof localStorage.setItem === 'function'); | ||
('setItem' in localStorage) && | ||
(localStorage.setItem)); | ||
} catch (e) { | ||
@@ -121,5 +137,3 @@ return false; | ||
// The actual localForage object that we expose as a module or via a | ||
// global. It's extended by pulling in one of our other libraries. | ||
var _this = this; | ||
var globalObject = this; | ||
@@ -249,3 +263,3 @@ function LocalForage(options) { | ||
} else { | ||
self._extend(_this[driverName]); | ||
self._extend(globalObject[driverName]); | ||
} | ||
@@ -268,2 +282,4 @@ | ||
// Used to determine which driver we should use as the backend for this | ||
// instance of localForage. | ||
LocalForage.prototype._getFirstSupportedDriver = function(drivers) { | ||
@@ -291,2 +307,4 @@ var isArray = Array.isArray || function(arg) { | ||
// The actual localForage object that we expose as a module or via a | ||
// global. It's extended by pulling in one of our other libraries. | ||
var localForage = new LocalForage(); | ||
@@ -293,0 +311,0 @@ |
// Run before window.onload to make sure the specs have access to describe() | ||
// and other mocha methods. All feels very hacky though :-/ | ||
var mocha = this.mocha; | ||
this.mocha.setup('bdd'); | ||
mocha.setup('bdd'); | ||
function runTests() { | ||
var runner = mocha.run(); | ||
var runner = this.mocha.run(); | ||
@@ -41,2 +39,14 @@ var failedTests = []; | ||
if (!Array.prototype.forEach) { | ||
Array.prototype.forEach = function(callback, thisArg) { | ||
if (typeof(callback) !== "function") { | ||
throw new TypeError(callback + " is not a function!"); | ||
} | ||
var len = this.length; | ||
for (var i = 0; i < len; i++) { | ||
callback.call(thisArg, this[i], i, this) | ||
} | ||
} | ||
} | ||
var require = this.require; | ||
@@ -61,4 +71,6 @@ if (require) { | ||
}); | ||
} else { | ||
} else if (this.addEventListener) { | ||
this.addEventListener('load', runTests); | ||
} else if (this.attachEvent) { | ||
this.attachEvent('onload', runTests); | ||
} |
@@ -35,3 +35,3 @@ /* global afterEach:true, before:true, beforeEach:true, describe:true, expect:true, it:true, Modernizr:true, Promise:true, require:true */ | ||
(localforage.supports(localforage.LOCALSTORAGE) && | ||
localforage.localStorage); | ||
localforage.LOCALSTORAGE); | ||
}); | ||
@@ -38,0 +38,0 @@ |
/* global beforeEach:true */ | ||
var mocha = this.mocha; | ||
this.mocha.setup('bdd'); | ||
mocha.setup('bdd'); | ||
beforeEach(function(done) { | ||
@@ -7,0 +5,0 @@ var previousDriver = localforage.driver(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
954833
11508