Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/prefs.js

Issue 29339112: Issue 3716 - Split up files stored in storage.local (Closed)
Patch Set: Remove setMultiple. Use suggested code. Created March 31, 2016, 9:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« lib/io.js ('K') | « lib/io.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 throw new Error("Attempt to change preference type"); 206 throw new Error("Attempt to change preference type");
207 207
208 if (value == defaultValue) 208 if (value == defaultValue)
209 { 209 {
210 delete overrides[pref]; 210 delete overrides[pref];
211 ext.storage.remove(prefToKey(pref)); 211 ext.storage.remove(prefToKey(pref));
212 } 212 }
213 else 213 else
214 { 214 {
215 overrides[pref] = value; 215 overrides[pref] = value;
216 ext.storage.set(prefToKey(pref), value); 216
217 let storageItems = {};
Sebastian Noack 2016/03/31 12:36:54 Nit: Just call this variable items for consistence
218 storageItems[prefToKey(pref)] = value;
219 ext.storage.set(storageItems);
217 } 220 }
218 }, 221 },
219 enumerable: true 222 enumerable: true
220 }); 223 });
221 } 224 }
222 225
223 function init() 226 function init()
224 { 227 {
225 let prefs = Object.keys(defaults); 228 let prefs = Object.keys(defaults);
226 prefs.forEach(addPreference); 229 prefs.forEach(addPreference);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 Prefs.onChanged._dispatch(pref); 279 Prefs.onChanged._dispatch(pref);
277 } 280 }
278 } 281 }
279 }); 282 });
280 } 283 }
281 284
282 Prefs.isLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded); 285 Prefs.isLoaded = Promise.all([localLoaded, managedLoaded]).then(onLoaded);
283 } 286 }
284 287
285 init(); 288 init();
OLDNEW
« lib/io.js ('K') | « lib/io.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld