create-packer 1.43.8 → 1.43.10
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
CHANGED
|
@@ -2,21 +2,21 @@ import { defineExtensionMessaging } from '@webext-core/messaging'
|
|
|
2
2
|
import { CONTENT_MATCHES } from './constant'
|
|
3
3
|
|
|
4
4
|
export type messageType = {
|
|
5
|
-
test: () =>
|
|
5
|
+
test: () => string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export const { sendMessage, onMessage } = defineExtensionMessaging<messageType>()
|
|
9
|
-
|
|
10
9
|
export async function sendToAllContent<A extends keyof messageType>(
|
|
11
10
|
action: A,
|
|
12
11
|
data?: Parameters<messageType[A]>[0]
|
|
13
12
|
) {
|
|
14
13
|
const tabs = await chrome.tabs.query({ url: CONTENT_MATCHES })
|
|
15
|
-
|
|
14
|
+
const result = await Promise.all(
|
|
16
15
|
tabs.map(tab => {
|
|
17
16
|
return sendMessage(action, data as never, { tabId: tab.id! })
|
|
18
17
|
})
|
|
19
18
|
)
|
|
19
|
+
return result
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export async function sendToCurrentContent<A extends keyof messageType>(
|
|
@@ -24,5 +24,6 @@ export async function sendToCurrentContent<A extends keyof messageType>(
|
|
|
24
24
|
data?: Parameters<messageType[A]>[0]
|
|
25
25
|
) {
|
|
26
26
|
const tabs = await chrome.tabs.query({ active: true, url: CONTENT_MATCHES })
|
|
27
|
-
|
|
27
|
+
const result = await sendMessage(action, data as never, { tabId: tabs[0].id! })
|
|
28
|
+
return result
|
|
28
29
|
}
|