idb-keyval
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,1 @@ | ||
(function(){"use strict";var db;function getDB(){if(!db){db=new Promise(function(resolve,reject){var openreq=indexedDB.open("keyval-store",1);openreq.onerror=function(){reject(openreq.error)};openreq.onupgradeneeded=function(){openreq.result.createObjectStore("keyval")};openreq.onsuccess=function(){resolve(openreq.result)}})}return db}function withStore(type,callback){return getDB().then(function(db){return new Promise(function(resolve,reject){var transaction=db.transaction("keyval",type);transaction.oncomplete=function(){resolve()};transaction.onerror=function(){reject(transaction.error)};callback(transaction.objectStore("keyval"))})})}var idbKeyval={get:function(key){var req;return withStore("readonly",function(store){req=store.get(key)}).then(function(){return req.result})},set:function(key,value){return withStore("readwrite",function(store){store.put(value,key)})},remove:function(key){return withStore("readwrite",function(store){store.delete(key)})},clear:function(){return withStore("readwrite",function(store){store.clear()})}};if(typeof module!="undefined"&&module.exports){module.exports=idbKeyval}else{self.idbKeyval=idbKeyval}})(); | ||
!function(){"use strict";function e(){return r||(r=new Promise(function(e,n){var r=indexedDB.open("keyval-store",1);r.onerror=function(){n(r.error)},r.onupgradeneeded=function(){r.result.createObjectStore("keyval")},r.onsuccess=function(){e(r.result)}})),r}function n(n,r){return e().then(function(e){return new Promise(function(t,o){var u=e.transaction("keyval",n);u.oncomplete=function(){t()},u.onerror=function(){o(u.error)},r(u.objectStore("keyval"))})})}var r,t={get:function(e){var r;return n("readonly",function(n){r=n.get(e)}).then(function(){return r.result})},set:function(e,r){return n("readwrite",function(n){n.put(r,e)})},remove:function(e){return n("readwrite",function(n){n.delete(e)})},clear:function(){return n("readwrite",function(e){e.clear()})}};"undefined"!=typeof module&&module.exports?module.exports=t:self.idbKeyval=t}(); |
{ | ||
"name": "idb-keyval", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A super-simple-small keyval store built on top of IndexedDB", | ||
"main": "idb-keyval.js", | ||
"scripts": { | ||
"build": "uglifyjs idb-keyval.js --output dist/idb-keyval-min.js" | ||
"build": "uglifyjs idb-keyval.js --screw-ie8 -mc --output dist/idb-keyval-min.js" | ||
}, | ||
@@ -9,0 +9,0 @@ "repository": { |
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
4774