@vacantthinker/firefox-addon-framework-easy 2026.604.1745 → 2026.604.1807

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
@@ -61,7 +61,7 @@ export function browserRuntimeManifestName() { }
61
61
 
62
62
  ### 📄 File: `src/browserRuntimeOnMessageCommon.js`
63
63
  ```javascript
64
- export function browserRuntimeOnMessageCommon() { }
64
+ export function browserRuntimeOnMessageCommon(act, message) { }
65
65
 
66
66
  ```
67
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0604.1745",
3
+ "version": "2026.0604.1807",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -5,34 +5,30 @@ import {browserTabSendMessage} from './browserTab.js';
5
5
  /**
6
6
  * offer common act <=> function, eg: actRemoveTab, actLog
7
7
  */
8
- export function browserRuntimeOnMessageCommon() {
9
- browser.runtime.onMessage.addListener(
10
- (message, sender) => {
11
- message['tabId'] = sender.tab?.id;
12
-
13
- let keyAct = 'act';
14
- /**
15
- * @type{
16
- * |'actLog'
17
- * |'actRemoveTab'
18
- * |'actDownloadFile'
19
- * |'actSendMessageToTab'
20
- * }
21
- */
22
- let act = message[keyAct];
23
- delete message[keyAct];
24
- if (act === 'actLog') {
25
- console.log('act', act, 'message', message);
26
- }
27
- else if (act === 'actRemoveTab') {
28
- tabOpRemove(message.tabId);
29
- }
30
- else if (act === 'actDownloadFile') {
31
- serviceDownloadByDownlink(message);
32
- }
33
- else if (act === 'actSendMessageToTab') {
34
- browserTabSendMessage(message.tabId, message);
35
- }
36
- });
8
+ /**
9
+ *
10
+ * @param act{
11
+ * 'actLog'
12
+ * |'actRemoveTab'
13
+ * |'actDownloadFile'
14
+ * |'actSendMessageToTab'
15
+ * }
16
+ * @param message
17
+ */
18
+ export function browserRuntimeOnMessageCommon(act, message) {
19
+ switch (act) {
20
+ case 'actLog':
21
+ console.log('act', act, 'message', message);
22
+ break;
23
+ case 'actRemoveTab':
24
+ tabOpRemove(message.tabId);
25
+ break;
26
+ case 'actDownloadFile':
27
+ serviceDownloadByDownlink(message);
28
+ break;
29
+ case 'actSendMessageToTab':
30
+ browserTabSendMessage(message.tabId, message);
31
+ break;
32
+ }
37
33
 
38
- }
34
+ }