|
22 | 22 | * This class holds all the logic related to user preferences persistance. |
23 | 23 | */ |
24 | 24 | constructor() { |
25 | | - if (globals.browser) { // Firefox uses `browser`, Chrome uses `chrome` |
26 | | - this.getAll = this.getAllFirefox; |
27 | | - this.setAll = this.setAllFirefox; |
| 25 | + if (globals.browser) { // Firefox and Edge uses `browser`, Chrome and Opera uses `chrome` |
| 26 | + this.getAll = this.getAllBrowser; |
| 27 | + this.setAll = this.setAllBrowser; |
28 | 28 | } else if (globals.chrome) { |
29 | 29 | this.getAll = this.getAllChrome; |
30 | 30 | this.setAll = this.setAllChrome; |
|
36 | 36 | /** |
37 | 37 | * Get all the user's preferences. |
38 | 38 | * |
39 | | - * Used as `getAll` if the current browser is Firefox. |
| 39 | + * Used as `getAll` if the current browser is Firefox or Edge. |
40 | 40 | */ |
41 | | - getAllFirefox(successCallback) { |
| 41 | + getAllBrowser(successCallback) { |
42 | 42 | browser.storage.local.get(this.defaults).then(successCallback, function() { |
43 | 43 | alert('Error retrieving extension preferences.'); |
44 | 44 | }); |
|
47 | 47 | /** |
48 | 48 | * Save all the user's preferences. |
49 | 49 | * |
50 | | - * Used as `setAll` if the current browser is Firefox. |
| 50 | + * Used as `setAll` if the current browser is Firefox or Edge. |
51 | 51 | */ |
52 | | - setAllFirefox(preferences, successCallback, errorCallback) { |
| 52 | + setAllBrowser(preferences, successCallback, errorCallback) { |
53 | 53 | browser.storage.local.set(preferences).then(successCallback, function() { |
54 | 54 | errorCallback(); |
55 | 55 |
|
|
60 | 60 | /** |
61 | 61 | * Get all the user's preferences. |
62 | 62 | * |
63 | | - * Used as `getAll` if the current browser is Chrome. |
| 63 | + * Used as `getAll` if the current browser is Chrome or Opera. |
64 | 64 | */ |
65 | 65 | getAllChrome(successCallback) { |
66 | 66 | chrome.storage.local.get(this.defaults, function(preferences) { |
|
77 | 77 | /** |
78 | 78 | * Save all the user's preferences. |
79 | 79 | * |
80 | | - * Used as `setAll` if the current browser is Chrome. |
| 80 | + * Used as `setAll` if the current browser is Chrome or Opera. |
81 | 81 | */ |
82 | 82 | setAllChrome(preferences, successCallback, errorCallback) { |
83 | 83 | chrome.storage.local.set(preferences, function() { |
|
0 commit comments