@vacantthinker/firefox-addon-framework-easy 2026.527.1212 → 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/README.md +2 -0
- package/package.json +1 -1
- package/src/opTab.js +19 -3
- package/src/serviceUserSettings.js +13 -16
package/README.md
CHANGED
|
@@ -105,6 +105,8 @@ export async function tabOpCreate(urlOrArgs) { }
|
|
|
105
105
|
|
|
106
106
|
export async function tabOpCreateNormal(urlOrArgs) { }
|
|
107
107
|
|
|
108
|
+
export async function tabOpCreateByWindow(url) { }
|
|
109
|
+
|
|
108
110
|
export async function tabOpRemove(tabId) { }
|
|
109
111
|
|
|
110
112
|
export async function tabOpHide(tabId) { }
|
package/package.json
CHANGED
package/src/opTab.js
CHANGED
|
@@ -51,7 +51,6 @@ export async function tabOpReload(tabId) {
|
|
|
51
51
|
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
52
52
|
*/
|
|
53
53
|
export async function tabOpCreate(urlOrArgs) {
|
|
54
|
-
try {
|
|
55
54
|
/**
|
|
56
55
|
* @type {browser.tabs._CreateCreateProperties}
|
|
57
56
|
*/
|
|
@@ -66,8 +65,6 @@ export async function tabOpCreate(urlOrArgs) {
|
|
|
66
65
|
Object.assign(urlOrArgs, source);
|
|
67
66
|
let tab = await browser.tabs.create(urlOrArgs);
|
|
68
67
|
return tabOpEnhance(tab)
|
|
69
|
-
} catch (e) {
|
|
70
|
-
}
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
/**
|
|
@@ -88,6 +85,25 @@ export async function tabOpCreateNormal(urlOrArgs) {
|
|
|
88
85
|
return tabOpEnhance(tab)
|
|
89
86
|
}
|
|
90
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Creates a normal tab using either a URL string or a properties object.
|
|
90
|
+
*
|
|
91
|
+
* @param {string} url
|
|
92
|
+
* @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
|
|
93
|
+
*/
|
|
94
|
+
export async function tabOpCreateByWindow(url) {
|
|
95
|
+
// If it's a string, wrap it in an object
|
|
96
|
+
if (typeof url === 'string') {
|
|
97
|
+
let window = await browser.windows.create({
|
|
98
|
+
url
|
|
99
|
+
});
|
|
100
|
+
let tab = window.tabs.shift();
|
|
101
|
+
return tabOpEnhance(tab)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
91
107
|
/**
|
|
92
108
|
*
|
|
93
109
|
* @param tabId{number}
|
|
@@ -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
|
/**
|