// Copyright (c) 2006-2008 by Martin Stubenschrott <stubenschrott@vimperator.org>
// Copyright (c) 2007-2011 by Doug Kearns <dougkearns@gmail.com>
-// Copyright (c) 2008-2012 Kris Maglione <maglione.k@gmail.com>
+// Copyright (c) 2008-2014 Kris Maglione <maglione.k@gmail.com>
//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
* @param {string} branch The preference name. @optional
*/
resetBranch: function resetBranch(branch) {
- this.getNames(branch).forEach(this.closure.reset);
+ this.getNames(branch).forEach(this.bound.reset);
},
/**
if (observers) {
let value = this.get(data, false);
this._observers[data] = observers.filter(function (callback) {
- if (!callback.get())
+ callback = callback.get();
+ if (!callback)
return false;
- util.trapErrors(callback.get(), null, value);
+ util.trapErrors(callback, null, value);
return true;
});
}
if (!this._observers[pref])
this._observers[pref] = [];
- this._observers[pref].push(!strong ? util.weakReference(callback) : { get: function () callback });
+ this._observers[pref].push(!strong ? util.weakReference(callback)
+ : { get: function () callback });
},
/**
function prefs() {
for (let [, pref] in Iterator(prefArray)) {
let userValue = services.pref.prefHasUserValue(pref);
- if (onlyNonDefault && !userValue || pref.indexOf(filter) == -1)
+ if (onlyNonDefault && !userValue || !pref.contains(filter))
continue;
let value = this.get(pref);
modules.completion.preference = function preference(context) {
context.anchored = false;
context.title = [config.host + " Preference", "Value"];
- context.keys = { text: function (item) item, description: function (item) prefs.get(item) };
+ context.keys = { text: function (item) item,
+ description: function (item) prefs.get(item) };
context.completions = prefs.getNames();
};
},
javascript: function init_javascript(dactyl, modules) {
modules.JavaScript.setCompleter([this.get, this.safeSet, this.set, this.reset, this.toggle],
- [function (context) (context.anchored=false, this.getNames().map(function (pref) [pref, ""]))]);
+ [function (context) (context.anchored=false, this.getNames().map(pref => [pref, ""]))]);
}
});