From cda9df17517b4df2b1356b27486b4728157412bd Mon Sep 17 00:00:00 2001 From: Federico Date: Sat, 9 Nov 2024 01:13:22 +0700 Subject: [PATCH] Optimization --- index.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/index.ts b/index.ts index c39d1c8..63f0883 100644 --- a/index.ts +++ b/index.ts @@ -24,7 +24,6 @@ function getManifest(_version?: 2 | 3): chrome.runtime.Manifest | undefined { return globalThis.chrome?.runtime?.getManifest?.(); } -/* @__PURE__ */ function once(function_: () => boolean): () => boolean { let result: boolean; return () => { @@ -115,13 +114,7 @@ export const isActionPopup = once((): boolean => { return true; } - const path = getManifest(3)?.action?.default_popup ?? getManifest(2)?.browser_action?.default_popup; - if (typeof path !== 'string') { - return false; - } - - const url = new URL(path, location.origin); - return url.pathname === location.pathname; + return isCurrentPathname(getManifest(3)?.action?.default_popup ?? getManifest(2)?.browser_action?.default_popup); }); /** Indicates whether you're in the main dev tools page, the one specified in the extension's `manifest.json` `devtools_page` field. */