Index: lib/prefs.js |
diff --git a/lib/prefs.js b/lib/prefs.js |
index e1aa3f751c5feb430e5dfb83ada7917bd777bd9f..0074fb99cfef943f56d239d0402c48af18ace412 100644 |
--- a/lib/prefs.js |
+++ b/lib/prefs.js |
@@ -17,6 +17,8 @@ |
/** @module prefs */ |
+"use strict"; |
+ |
let {EventEmitter} = require("events"); |
const keyPrefix = "pref:"; |
@@ -188,7 +190,7 @@ let Prefs = exports.Prefs = { |
* @param {string} preference |
* @param {function} callback |
*/ |
- on: function(preference, callback) |
+ on(preference, callback) |
{ |
eventEmitter.on(preference, callback); |
}, |
@@ -199,7 +201,7 @@ let Prefs = exports.Prefs = { |
* @param {string} preference |
* @param {function} callback |
*/ |
- off: function(preference, callback) |
+ off(preference, callback) |
{ |
eventEmitter.off(preference, callback); |
}, |
@@ -230,11 +232,8 @@ function prefToKey(pref) |
function addPreference(pref) |
{ |
Object.defineProperty(Prefs, pref, { |
- get: function() |
- { |
- return (pref in overrides ? overrides : defaults)[pref]; |
- }, |
- set: function(value) |
+ get() { return (pref in overrides ? overrides : defaults)[pref]; }, |
+ set(value) |
{ |
let defaultValue = defaults[pref]; |
@@ -262,7 +261,7 @@ function init() |
prefs.forEach(addPreference); |
let localLoaded = new Promise(resolve => { |
- ext.storage.get(prefs.map(prefToKey), function(items) |
+ ext.storage.get(prefs.map(prefToKey), items => |
{ |
for (let key in items) |
overrides[keyToPref(key)] = items[key]; |
@@ -274,7 +273,7 @@ function init() |
let managedLoaded = new Promise(resolve => { |
if (require("info").platform == "chromium" && "managed" in chrome.storage) |
{ |
- chrome.storage.managed.get(null, function(items) |
+ chrome.storage.managed.get(null, items => |
{ |
// Opera doesn't support chrome.storage.managed, but instead simply |
// removing the API, Opera sets chrome.runtime.lastError when using it. |
@@ -296,7 +295,7 @@ function init() |
function onLoaded() |
{ |
- ext.storage.onChanged.addListener(function(changes) |
+ ext.storage.onChanged.addListener(changes => |
{ |
for (let key in changes) |
{ |