Skip to content

Commit

Permalink
Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante committed Nov 8, 2024
1 parent 3a8d8bd commit cda9df1
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit cda9df1

Please sign in to comment.