1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-13 06:15:53 +01:00

Change Storage#newObject signature.

This commit is contained in:
Kris Maglione
2009-10-29 20:30:24 -04:00
parent 172d04c1f2
commit 9bb01ce7ef
5 changed files with 12 additions and 12 deletions

View File

@@ -306,14 +306,14 @@ var timers = {};
var storage = {
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();
let load = function () loadPref(key, store, type || Object);
keys[key] = new constructor(key, store, load, options || {});
let load = function () loadPref(key, params.store, params.type || Object);
keys[key] = new constructor(key, params.store, load, params);
timers[key] = new Timer(1000, 10000, function () storage.save(key));
this.__defineGetter__(key, function () keys[key]);
}
@@ -322,12 +322,12 @@ var storage = {
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)
{
return this.newObject(key, ArrayStore, store, Array, options);
return this.newObject(key, ArrayStore, store, { type: Array, __proto__: options });
},
addObserver: function addObserver(key, callback, ref)