Skip to content

Commit 9e6624f

Browse files
committed
content preload prefs from local storage
1 parent cb9b94f commit 9e6624f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/weh-content.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ var readyPromises = [
6767
if(usePrefs) {
6868
let wehPrefs = require('weh-prefs');
6969
weh.prefs = wehPrefs;
70-
wehPrefs.assign({});
70+
let initialPrefs = {};
71+
try {
72+
let prefsStr = localStorage.getItem("weh-prefs");
73+
if(prefsStr)
74+
JSON.parse(prefsStr).forEach((entry)=>{
75+
initialPrefs[entry.name] = entry.value;
76+
});
77+
} catch(e) {}
78+
wehPrefs.assign(initialPrefs);
7179
wehPrefs.on("", {
7280
pack: true
7381
}, function (newPrefs, oldPrefs) {

0 commit comments

Comments
 (0)