webext-messenger
Advanced tools
Comparing version 0.29.0-0 to 0.29.0
@@ -29,18 +29,20 @@ import { getContextName, isBackground, isExtensionContext, isOffscreenDocument, } from "webext-detect"; | ||
// If a message is received before this is ready, it will just have to be ignored. | ||
export const thisTarget = isBackground() | ||
? { page: "background" } | ||
: (isOffscreenDocument() | ||
? { page: "offscreen" } | ||
: { | ||
get page() { | ||
// Extension pages have relative URLs to simplify comparison | ||
const origin = location.protocol.startsWith("http") | ||
? location.origin | ||
: ""; | ||
// Don't use the hash | ||
return origin + location.pathname + location.search; | ||
}, | ||
}); | ||
export const thisTarget = (() => { | ||
if (isBackground()) | ||
return { page: "background" }; | ||
if (isOffscreenDocument()) | ||
return { page: "offscreen" }; | ||
return { | ||
get page() { | ||
// Extension pages have relative URLs to simplify comparison | ||
const origin = location.protocol.startsWith("http") | ||
? location.origin | ||
: ""; | ||
// Don't use the hash | ||
return origin + location.pathname + location.search; | ||
}, | ||
}; | ||
})(); | ||
let tabDataStatus = | ||
// The background page doesn't have a tab | ||
// Exclude contexts that don't have a tab associated to them | ||
isBackground() || isOffscreenDocument() ? "not-needed" : "needed"; | ||
@@ -57,3 +59,3 @@ export function getTabDataStatus() { | ||
if ("prerendering" in document && Boolean(document.prerendering)) { | ||
await pEvent(document, 'prerenderingchange'); | ||
await pEvent(document, "prerenderingchange"); | ||
} | ||
@@ -80,4 +82,3 @@ try { | ||
try { | ||
moreInfo = `(context: ${getContextName()}, url: ${globalThis.location | ||
?.href})`; | ||
moreInfo = `(context: ${getContextName()}, url: ${globalThis.location?.href})`; | ||
} | ||
@@ -84,0 +85,0 @@ catch { } |
{ | ||
"name": "webext-messenger", | ||
"version": "0.29.0-0", | ||
"version": "0.29.0", | ||
"description": "Browser Extension component messaging framework", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
@@ -22,5 +22,4 @@ # webext-messenger [![][badge-gzip]][link-bundlephobia] | ||
## npm publishing | ||
Collaborators can publish a new version of what's on main [via "workflow_dispatch"](https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/) under [Actions » Publish](https://github.com/pixiebrix/webext-messenger/actions/workflows/npm-publish.yml) |
37943
743
25