mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-12 01:55:46 +01:00
Change Storage#newObject signature.
This commit is contained in:
@@ -249,7 +249,7 @@ function Bookmarks() //{{{
|
|||||||
statusline.updateUrl();
|
statusline.updateUrl();
|
||||||
};
|
};
|
||||||
|
|
||||||
var cache = storage.newObject("bookmark-cache", Cache, false);
|
var cache = storage.newObject("bookmark-cache", Cache, { store: false });
|
||||||
storage.addObserver("bookmark-cache", bookmarkObserver, window);
|
storage.addObserver("bookmark-cache", bookmarkObserver, window);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function Browser() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).init();
|
}).init();
|
||||||
}, false);
|
}, { store: false });
|
||||||
storage.addObserver("private-mode",
|
storage.addObserver("private-mode",
|
||||||
function (key, event, value) {
|
function (key, event, value) {
|
||||||
autocommands.trigger("PrivateMode", { state: value });
|
autocommands.trigger("PrivateMode", { state: value });
|
||||||
|
|||||||
@@ -581,12 +581,12 @@ let (array = util.Array)
|
|||||||
/**
|
/**
|
||||||
* @property {Styles}
|
* @property {Styles}
|
||||||
*/
|
*/
|
||||||
const styles = storage.newObject("styles", Styles, false);
|
const styles = storage.newObject("styles", Styles, { store: false });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {Highlights}
|
* @property {Highlights}
|
||||||
*/
|
*/
|
||||||
const highlight = storage.newObject("highlight", Highlights, false);
|
const highlight = storage.newObject("highlight", Highlights, { store: false });
|
||||||
|
|
||||||
if (highlight.CSS != Highlights.prototype.CSS)
|
if (highlight.CSS != Highlights.prototype.CSS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ function CommandLine() //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).init();
|
}).init();
|
||||||
}, false);
|
}, { store: false });
|
||||||
storage.addObserver("sanitize",
|
storage.addObserver("sanitize",
|
||||||
function (key, event, value) {
|
function (key, event, value) {
|
||||||
autocommands.trigger("Sanitize", {});
|
autocommands.trigger("Sanitize", {});
|
||||||
|
|||||||
@@ -306,14 +306,14 @@ var timers = {};
|
|||||||
|
|
||||||
var storage = {
|
var storage = {
|
||||||
alwaysReload: {},
|
alwaysReload: {},
|
||||||
newObject: function newObject(key, constructor, store, type, options, reload)
|
newObject: function newObject(key, constructor, params)
|
||||||
{
|
{
|
||||||
if (!(key in keys) || reload || this.alwaysReload[key])
|
if (!(key in keys) || params.reload || this.alwaysReload[key])
|
||||||
{
|
{
|
||||||
if (key in this && !(reload || this.alwaysReload[key]))
|
if (key in this && !(params.reload || this.alwaysReload[key]))
|
||||||
throw Error();
|
throw Error();
|
||||||
let load = function () loadPref(key, store, type || Object);
|
let load = function () loadPref(key, params.store, params.type || Object);
|
||||||
keys[key] = new constructor(key, store, load, options || {});
|
keys[key] = new constructor(key, params.store, load, params);
|
||||||
timers[key] = new Timer(1000, 10000, function () storage.save(key));
|
timers[key] = new Timer(1000, 10000, function () storage.save(key));
|
||||||
this.__defineGetter__(key, function () keys[key]);
|
this.__defineGetter__(key, function () keys[key]);
|
||||||
}
|
}
|
||||||
@@ -322,12 +322,12 @@ var storage = {
|
|||||||
|
|
||||||
newMap: function newMap(key, store, options)
|
newMap: function newMap(key, store, options)
|
||||||
{
|
{
|
||||||
return this.newObject(key, ObjectStore, store, null, options);
|
return this.newObject(key, ObjectStore, store, options);
|
||||||
},
|
},
|
||||||
|
|
||||||
newArray: function newArray(key, store, options)
|
newArray: function newArray(key, store, options)
|
||||||
{
|
{
|
||||||
return this.newObject(key, ArrayStore, store, Array, options);
|
return this.newObject(key, ArrayStore, store, { type: Array, __proto__: options });
|
||||||
},
|
},
|
||||||
|
|
||||||
addObserver: function addObserver(key, callback, ref)
|
addObserver: function addObserver(key, callback, ref)
|
||||||
|
|||||||
Reference in New Issue
Block a user