forked from zombieFox/nightTab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.js
More file actions
44 lines (35 loc) · 722 Bytes
/
Copy pathdata.js
File metadata and controls
44 lines (35 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var data = (function() {
var saveName = "nitghTab";
var set = function(key, data) {
localStorage.setItem(key, data);
};
var get = function(key) {
return localStorage.getItem(key);
};
var clear = function(key) {
localStorage.removeItem(key);
};
var save = function() {
var data = {
state: state.get(),
bookmarks: bookmarks.get()
};
set(saveName, JSON.stringify(data));
console.log("data saved");
};
var load = function() {
var data = JSON.parse(get(saveName));
return data;
};
var wipe = function() {
clear(saveName);
};
return {
save: save,
clear: clear,
set: set,
get: get,
wipe: wipe,
load: load
};
})();