@fireproof/core 0.7.2-dev.2 → 0.7.2-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database.js +1 -0
- package/dist/src/fireproof.js +7 -6
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +7 -6
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/browser.js +8 -7
- package/package.json +1 -1
- package/src/database.js +1 -0
- package/src/storage/browser.js +6 -6
package/dist/src/fireproof.mjs
CHANGED
@@ -39074,10 +39074,6 @@ const defaultConfig$1 = {
|
|
39074
39074
|
class Browser extends Base {
|
39075
39075
|
constructor (name, config = {}) {
|
39076
39076
|
super(name, Object.assign({}, defaultConfig$1, config));
|
39077
|
-
this.isBrowser = false;
|
39078
|
-
try {
|
39079
|
-
this.isBrowser = window.localStorage && true;
|
39080
|
-
} catch (e) {}
|
39081
39077
|
}
|
39082
39078
|
|
39083
39079
|
withDB = async dbWorkFun => {
|
@@ -39117,12 +39113,16 @@ class Browser extends Base {
|
|
39117
39113
|
}
|
39118
39114
|
|
39119
39115
|
loadHeader (branch = 'main') {
|
39120
|
-
|
39116
|
+
try {
|
39117
|
+
return localStorage.getItem(this.headerKey(branch))
|
39118
|
+
} catch (e) {}
|
39121
39119
|
}
|
39122
39120
|
|
39123
39121
|
async writeHeader (branch, header) {
|
39124
39122
|
if (this.config.readonly) return
|
39125
|
-
|
39123
|
+
try {
|
39124
|
+
return localStorage.setItem(this.headerKey(branch), this.prepareHeader(header))
|
39125
|
+
} catch (e) {}
|
39126
39126
|
}
|
39127
39127
|
|
39128
39128
|
headerKey (branch = 'main') {
|
@@ -41640,6 +41640,7 @@ class Database {
|
|
41640
41640
|
* @instance
|
41641
41641
|
*/
|
41642
41642
|
toJSON () {
|
41643
|
+
// todo this prepareHeader ignores secondary storage, need both
|
41643
41644
|
return this.blocks.valet ? this.blocks.valet.primary.prepareHeader(this.toHeader(), false) : this.toHeader() // omg
|
41644
41645
|
}
|
41645
41646
|
|