@inboxsdk/core 0.1.1 → 0.2.2
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/background.d.ts +1 -0
- package/background.js +16 -0
- package/inboxsdk.d.ts +802 -0
- package/inboxsdk.js +56 -59
- package/package.json +14 -4
- package/pageWorld.d.ts +1 -0
package/background.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/background.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
2
|
+
if (message.type === 'inboxsdk__injectPageWorld' && sender.tab) {
|
|
3
|
+
if (chrome.scripting) {
|
|
4
|
+
// MV3
|
|
5
|
+
chrome.scripting.executeScript({
|
|
6
|
+
target: { tabId: sender.tab.id },
|
|
7
|
+
world: 'MAIN',
|
|
8
|
+
files: ['pageWorld.js']
|
|
9
|
+
});
|
|
10
|
+
sendResponse(true);
|
|
11
|
+
} else {
|
|
12
|
+
// MV2 fallback. Tell content script it needs to figure things out.
|
|
13
|
+
sendResponse(false);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|