[refactor] improve state module

This commit is contained in:
zombieFox 2019-07-20 11:40:26 +01:00
parent 5d6ccdc118
commit 8648f4d0d5
3 changed files with 13 additions and 6 deletions

View File

@ -1,6 +1,8 @@
var state = (function() { var state = (function() {
var current = { var mod = {};
mod.current = {
header: { header: {
area: { area: {
width: 100, width: 100,
@ -218,11 +220,11 @@ var state = (function() {
autoSuggest: false, autoSuggest: false,
}; };
var get = function() { mod.get = function() {
return current; return current;
}; };
var restore = function(data) { mod.restore = function(data) {
if ("state" in data) { if ("state" in data) {
current = data.state; current = data.state;
}; };
@ -230,12 +232,17 @@ var state = (function() {
var init = function() { var init = function() {
if (data.load()) { if (data.load()) {
restore(data.load()); mod.restore(data.load());
}; };
}; };
var get = function() {
return mod.get();
};
return { return {
init: init, init: init,
mod: mod,
get: get get: get
}; };

View File

@ -1,6 +1,6 @@
var version = (function() { var version = (function() {
var current = "3.57.0"; var current = "3.58.0";
var compare = function(a, b) { var compare = function(a, b) {
var pa = a.split("."); var pa = a.split(".");

View File

@ -2,7 +2,7 @@
"name": "nightTab", "name": "nightTab",
"short_name": "nightTab", "short_name": "nightTab",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.", "description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "3.57.0", "version": "3.58.0",
"manifest_version": 2, "manifest_version": 2,
"chrome_url_overrides": { "chrome_url_overrides": {
"newtab": "index.html" "newtab": "index.html"