1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-05 05:25:45 +01:00

Formatting fixes.

This commit is contained in:
Doug Kearns
2009-08-29 22:22:50 +10:00
parent 2df0e8ee49
commit 0650e55fbc

12
common/modules/storage.jsm Normal file → Executable file
View File

@@ -22,7 +22,7 @@ function Timer(minInterval, maxInterval, callback)
{ {
timer.cancel(); timer.cancel();
this.latest = 0; this.latest = 0;
/* minInterval is the time between the completion of the command and the next firing. */ // minInterval is the time between the completion of the command and the next firing
this.doneAt = Date.now() + minInterval; this.doneAt = Date.now() + minInterval;
try try
@@ -145,7 +145,7 @@ function loadPref(name, store, type)
if (pref) if (pref)
{ {
prefService.clearUserPref(name); prefService.clearUserPref(name);
savePref({ name: name, store: true, serial: pref }) savePref({ name: name, store: true, serial: pref });
} }
if (result instanceof type) if (result instanceof type)
return result; return result;
@@ -161,8 +161,8 @@ function savePref(obj)
var prototype = { var prototype = {
OPTIONS: ["privateData"], OPTIONS: ["privateData"],
fireEvent: function (event, arg) { storage.fireEvent(this.name, event, arg) }, fireEvent: function (event, arg) { storage.fireEvent(this.name, event, arg); },
save: function () { savePref(this) }, save: function () { savePref(this); },
init: function (name, store, data, options) init: function (name, store, data, options)
{ {
this.__defineGetter__("store", function () store); this.__defineGetter__("store", function () store);
@@ -293,7 +293,7 @@ var storage = {
{ {
if (key in this && !reload) if (key in this && !reload)
throw Error; throw Error;
let load = function() loadPref(key, store, type || Object); let load = function () loadPref(key, store, type || Object);
keys[key] = new constructor(key, store, load, options || {}); keys[key] = new constructor(key, store, load, options || {});
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]);
@@ -345,7 +345,7 @@ var storage = {
{ {
for (let [key, ary] in Iterator(observers)) for (let [key, ary] in Iterator(observers))
{ {
observers[key] = ary = ary.filter(function (o) o.callback.get() && (!o.ref || o.ref.get() && o.ref.get().liberatorStorageRefs)) observers[key] = ary = ary.filter(function (o) o.callback.get() && (!o.ref || o.ref.get() && o.ref.get().liberatorStorageRefs));
if (!ary.length) if (!ary.length)
delete observers[key]; delete observers[key];
} }