@vacantthinker/firefox-addon-framework-easy 2026.527.2043 → 2026.527.2111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/serviceUserSettings.js +13 -16
package/package.json
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
import {stoOpGet, stoOpSet} from './opStorage.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* this function connect with generateHtmlByUserSettings()
|
|
5
4
|
*
|
|
6
|
-
* @param userSettings{
|
|
5
|
+
* @param userSettings{Object}
|
|
7
6
|
* @returns {Promise<void>}
|
|
8
7
|
*/
|
|
9
8
|
export async function serviceInitUserSettings(userSettings) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
9
|
+
const initPromises = Object.entries(userSettings).
|
|
10
|
+
map(async ([key, setting]) => {
|
|
11
|
+
const oldValue = await stoOpGet(key);
|
|
12
|
+
|
|
13
|
+
// FIX: Check strictly for null or undefined.
|
|
14
|
+
// This allows `false` and `0` to be recognized as valid saved values.
|
|
15
|
+
if (oldValue === null || oldValue === undefined) {
|
|
16
|
+
await stoOpSet(key, setting.selected);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await Promise.all(initPromises);
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
/**
|