@vacantthinker/firefox-addon-framework-easy 2026.527.2111 → 2026.528.1550

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 CHANGED
@@ -91,6 +91,16 @@ export async function stoOpSetNull(k) { }
91
91
 
92
92
  ### 📄 File: `src/opTab.js`
93
93
  ```javascript
94
+ export async function tabOpEnhance(tab) { }
95
+
96
+ export async function tabOpCreate(properties) { }
97
+
98
+ export async function tabOpCreateNear(properties) { }
99
+
100
+ export async function tabOpCreateActiveFalse(properties) { }
101
+
102
+ export async function tabOpCreateByWindow(url) { }
103
+
94
104
  export async function tabOpGet(tabId) { }
95
105
 
96
106
  export async function tabOpQueryAll() { }
@@ -101,12 +111,6 @@ export async function tabOpQueryUrlThenRemove(urlQuery) { }
101
111
 
102
112
  export async function tabOpReload(tabId) { }
103
113
 
104
- export async function tabOpCreate(urlOrArgs) { }
105
-
106
- export async function tabOpCreateNormal(urlOrArgs) { }
107
-
108
- export async function tabOpCreateByWindow(url) { }
109
-
110
114
  export async function tabOpRemove(tabId) { }
111
115
 
112
116
  export async function tabOpHide(tabId) { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0527.2111",
3
+ "version": "2026.0528.1550",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -1,4 +1,4 @@
1
- import {tabOpCreate} from './opTab.js';
1
+ import {tabOpCreateActiveFalse} from './opTab.js';
2
2
  import {browserNotificationCreate} from './browserNotification.js';
3
3
 
4
4
  export function browserRuntimeReload() {
@@ -31,7 +31,8 @@ export function browserRuntimeOnUpdateAvailable(doWhat = null) {
31
31
  );
32
32
  browser.notifications.onClicked.addListener(async (notificationId) => {
33
33
  if (notificationId === id) {
34
- await tabOpCreate('https://addons.mozilla.org/en-US/firefox/user/17783213/');
34
+ let url = 'https://addons.mozilla.org/en-US/firefox/user/17783213/';
35
+ await tabOpCreateActiveFalse({url});
35
36
  }
36
37
  });
37
38
  } catch (e) {
package/src/opTab.js CHANGED
@@ -1,3 +1,73 @@
1
+ /**
2
+ * Creates a normal tab using either a URL string or a properties object.
3
+ *
4
+ * @param tab{browser.tabs.Tab}
5
+ * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
6
+ */
7
+ export async function tabOpEnhance(tab) {
8
+ return Object.assign({}, tab, {tabId: tab.id});
9
+ }
10
+
11
+ /**
12
+ * Creates a normal tab using either a URL string or a properties object.
13
+ *
14
+ * @param {browser.tabs._CreateCreateProperties} properties
15
+ * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
16
+ */
17
+ export async function tabOpCreate(properties) {
18
+ // Otherwise, assume it is already a properties object
19
+ let tab = await browser.tabs.create(properties);
20
+ return tabOpEnhance(tab);
21
+ }
22
+
23
+ /**
24
+ *
25
+ * @param {browser.tabs._CreateCreateProperties & {tabId: number} } properties
26
+ * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
27
+ */
28
+ export async function tabOpCreateNear(properties) {
29
+ let tabPrev = await tabOpGet(properties.tabId);
30
+ Object.assign(properties, {
31
+ index: tabPrev.index + 1, openerTabId: tabPrev.id,
32
+ })
33
+
34
+ let tab = await tabOpCreate(properties);
35
+ return tabOpEnhance(tab);
36
+ }
37
+
38
+
39
+ /**
40
+ * {active: false, muted: true}
41
+ * @param properties{browser.tabs._CreateCreateProperties}
42
+ * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
43
+ */
44
+ export async function tabOpCreateActiveFalse(properties) {
45
+ /**
46
+ * @type {browser.tabs._CreateCreateProperties}
47
+ */
48
+ let source = {active: false, muted: true};
49
+ Object.assign(properties, source);
50
+ let tab = await browser.tabs.create(properties);
51
+ return tabOpEnhance(tab);
52
+ }
53
+
54
+ /**
55
+ * Creates a normal tab using either a URL string or a properties object.
56
+ *
57
+ * @param {string} url
58
+ * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
59
+ */
60
+ export async function tabOpCreateByWindow(url) {
61
+ // If it's a string, wrap it in an object
62
+ if (typeof url === 'string') {
63
+ let window = await browser.windows.create({
64
+ url,
65
+ });
66
+ let tab = window.tabs.shift();
67
+ return tabOpEnhance(tab);
68
+ }
69
+ }
70
+
1
71
  /**
2
72
  *
3
73
  * @param tabId{number}
@@ -44,66 +114,6 @@ export async function tabOpReload(tabId) {
44
114
  await browser.tabs.reload(tabId);
45
115
  }
46
116
 
47
- /**
48
- * {active: false, muted: true}
49
- * Creates a normal tab using either a URL string or a properties object.
50
- * @param urlOrArgs{string|browser.tabs._CreateCreateProperties}
51
- * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
52
- */
53
- export async function tabOpCreate(urlOrArgs) {
54
- /**
55
- * @type {browser.tabs._CreateCreateProperties}
56
- */
57
- let source = {active: false, muted: true};
58
- // If it's a string, wrap it in an object
59
- if (typeof urlOrArgs === 'string') {
60
- let tab = await browser.tabs.create(Object.assign(
61
- {url: urlOrArgs}, source,
62
- ));
63
- return tabOpEnhance(tab);
64
- }
65
- Object.assign(urlOrArgs, source);
66
- let tab = await browser.tabs.create(urlOrArgs);
67
- return tabOpEnhance(tab)
68
- }
69
-
70
- /**
71
- * Creates a normal tab using either a URL string or a properties object.
72
- *
73
- * @param {string|browser.tabs._CreateCreateProperties} urlOrArgs
74
- * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
75
- */
76
- export async function tabOpCreateNormal(urlOrArgs) {
77
- // If it's a string, wrap it in an object
78
- if (typeof urlOrArgs === 'string') {
79
- let tab = await browser.tabs.create({url: urlOrArgs});
80
- return tabOpEnhance(tab)
81
- }
82
-
83
- // Otherwise, assume it is already a properties object
84
- let tab = await browser.tabs.create(urlOrArgs);
85
- return tabOpEnhance(tab)
86
- }
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
-
107
117
  /**
108
118
  *
109
119
  * @param tabId{number}
@@ -130,16 +140,6 @@ export async function tabOpHide(tabId) {
130
140
  }
131
141
  }
132
142
 
133
- /**
134
- * Creates a normal tab using either a URL string or a properties object.
135
- *
136
- * @param tab{browser.tabs.Tab}
137
- * @returns {Promise<(browser.tabs.Tab & {tabId: number})>}
138
- */
139
- async function tabOpEnhance(tab) {
140
- return Object.assign(tab, {tabId: tab.id});
141
- }
142
-
143
143
  /**
144
144
  *
145
145
  * @param {number}tabId
@@ -170,7 +170,7 @@ export async function tabOpFocus(tabId) {
170
170
 
171
171
  let updateProperties = {active: true, highlighted: true};
172
172
  let tabUpdated = await tabOpUpdate(tabId, updateProperties);
173
- return tabOpEnhance(tabUpdated)
173
+ return tabOpEnhance(tabUpdated);
174
174
  }
175
175
 
176
176
  /**