1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-20 07:35:45 +01:00
This commit is contained in:
Kris Maglione
2011-09-29 17:57:55 -04:00
parent 06e89e84d2
commit acd13342a4
4 changed files with 37 additions and 13 deletions

View File

@@ -7,9 +7,10 @@
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("storage", {
exports: ["File", "Storage", "storage"],
require: ["config", "services", "util"]
require: ["services", "util"]
}, this);
this.lazyRequire("config", ["config"]);
this.lazyRequire("io", ["IO"]);
var win32 = /^win(32|nt)$/i.test(services.runtime.OS);
@@ -17,12 +18,17 @@ var myObject = JSON.parse("{}").constructor;
function loadData(name, store, type) {
try {
let data = storage.infoPath.child(name).read();
let result = JSON.parse(data);
if (result instanceof type)
return result;
let file = storage.infoPath.child(name);
if (file.exists()) {
let data = file.read();
let result = JSON.parse(data);
if (result instanceof type)
return result;
}
}
catch (e) {
util.reportError(e);
}
catch (e) {}
}
function saveData(obj) {