-// Copyright (c) 2008-2012 Kris Maglione <maglione.k at Gmail>
+// Copyright (c) 2008-2013 Kris Maglione <maglione.k at Gmail>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
this._load = load;
this._options = options;
- this.__defineGetter__("store", function () store);
- this.__defineGetter__("name", function () name);
+ this.__defineGetter__("store", () => store);
+ this.__defineGetter__("name", () => name);
for (let [k, v] in Iterator(options))
if (this.OPTIONS.indexOf(k) >= 0)
this[k] = v;
delete this.dactylSession[key];
},
- infoPath: Class.Memoize(function ()
+ infoPath: Class.Memoize(() =>
File(IO.runtimePath.replace(/,.*/, ""))
.child("info").child(config.profileName)),
if (!(key in this.observers))
this.observers[key] = [];
- if (!this.observers[key].some(function (o) o.callback.get() == callback))
- this.observers[key].push({ ref: ref && Cu.getWeakReference(ref), callback: callbackRef });
+ if (!this.observers[key].some(o => o.callback.get() == callback))
+ this.observers[key].push({ ref: ref && Cu.getWeakReference(ref),
+ callback: callbackRef });
},
removeObserver: function (key, callback) {
if (!(key in this.observers))
return;
- this.observers[key] = this.observers[key].filter(function (elem) elem.callback.get() != callback);
+ this.observers[key] = this.observers[key].filter(elem => elem.callback.get() != callback);
if (this.observers[key].length == 0)
delete obsevers[key];
},
return this;
},
- charset: Class.Memoize(function () File.defaultEncoding),
+ charset: Class.Memoize(() => File.defaultEncoding),
/**
* @property {nsIFileURL} Returns the nsIFileURL object for this file.
let array = [e for (e in this.iterDirectory())];
if (sort)
- array.sort(function (a, b) b.isDirectory() - a.isDirectory() || String.localeCompare(a.path, b.path));
+ array.sort((a, b) => (b.isDirectory() - a.isDirectory() ||
+ String.localeCompare(a.path, b.path)));
return array;
},
// Kris reckons we shouldn't replicate this 'bug'. --djk
// TODO: should we be doing this for all paths?
function expand(path) path.replace(
- !win32 ? /\$(\w+)\b|\${(\w+)}/g
- : /\$(\w+)\b|\${(\w+)}|%(\w+)%/g,
- function (m, n1, n2, n3) getenv(n1 || n2 || n3) || m
- );
+ win32 ? /\$(\w+)\b|\${(\w+)}|%(\w+)%/g
+ : /\$(\w+)\b|\${(\w+)}/g,
+ (m, n1, n2, n3) => (getenv(n1 || n2 || n3) || m));
path = expand(path);
// expand ~