@nozbe/lokijs
Advanced tools
Comparing version 1.5.12-wmelon5 to 1.5.12-wmelon6
{ | ||
"name": "@nozbe/lokijs", | ||
"version": "1.5.12-wmelon5", | ||
"version": "1.5.12-wmelon6", | ||
"description": "Nozbe's fork of LokiJS, optimized for WatermelonDB", | ||
@@ -5,0 +5,0 @@ "homepage": "https://techfort.github.io/LokiJS/", |
@@ -51,2 +51,4 @@ (function(root, factory) { | ||
* Can be tuned for a specific application | ||
* @param {array} options.lazyCollections Names of collections that should be deserialized lazily | ||
* Only use this for collections that aren't used at launch | ||
*/ | ||
@@ -539,4 +541,20 @@ function IncrementalIndexedDBAdapter(options) { | ||
function onDidOpen(db) { | ||
var openRequest = indexedDB.open(dbname, 1); | ||
openRequest.onupgradeneeded = function(e) { | ||
var db = e.target.result; | ||
DEBUG && console.log('onupgradeneeded, old version: ' + e.oldVersion); | ||
if (e.oldVersion < 1) { | ||
// Version 1 - Initial - Create database | ||
db.createObjectStore('LokiIncrementalData', { keyPath: "key" }); | ||
} else { | ||
// Unknown version | ||
throw new Error("Invalid old version " + e.oldVersion + " for IndexedDB upgrade"); | ||
} | ||
}; | ||
openRequest.onsuccess = function(e) { | ||
that.idbInitInProgress = false; | ||
var db = e.target.result; | ||
that.idb = db; | ||
@@ -574,32 +592,4 @@ | ||
onSuccess(); | ||
} | ||
if (this.options.preloads && this.options.preloads.idb) { | ||
DEBUG && console.log('using preloaded idb'); | ||
onDidOpen(this.options.preloads.idb); | ||
this.options.preloads.idb = null; | ||
return; | ||
} | ||
var openRequest = indexedDB.open(dbname, 1); | ||
openRequest.onupgradeneeded = function(e) { | ||
var db = e.target.result; | ||
DEBUG && console.log('onupgradeneeded, old version: ' + e.oldVersion); | ||
if (e.oldVersion < 1) { | ||
// Version 1 - Initial - Create database | ||
db.createObjectStore('LokiIncrementalData', { keyPath: "key" }); | ||
} else { | ||
// Unknown version | ||
throw new Error("Invalid old version " + e.oldVersion + " for IndexedDB upgrade"); | ||
} | ||
}; | ||
openRequest.onsuccess = function(e) { | ||
that.idbInitInProgress = false; | ||
var db = e.target.result; | ||
onDidOpen(db); | ||
}; | ||
openRequest.onblocked = function(e) { | ||
@@ -703,13 +693,7 @@ console.error("IndexedDB open is blocked", e); | ||
if (that.options.preloads && that.options.preloads.keys) { | ||
DEBUG && console.log('using preloaded keys'); | ||
onDidGetKeys(that.options.preloads.keys); | ||
that.options.preloads.keys = null; | ||
} else { | ||
idbReq(store.getAllKeys(), function(e) { | ||
onDidGetKeys(e.target.result); | ||
}, function(e) { | ||
callback(e); | ||
}); | ||
} | ||
idbReq(store.getAllKeys(), function(e) { | ||
onDidGetKeys(e.target.result); | ||
}, function(e) { | ||
callback(e); | ||
}); | ||
@@ -716,0 +700,0 @@ if (that.options.onFetchStart) { |
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
712855
14286