Skip to content

API > wxt > SpaContentScriptOptions

Interface: SpaContentScriptOptions ​

See BaseContentScriptEntrypointOptions.spa.

Contents ​

Properties ​

key ​

key?: (url) => string

Reduce a URL to the part the content script cares about. main is only re-run when this value changes between two matching URLs.

Defaults to everything but the hash, so jumping to an anchor doesn't tear down your UI, but changing a query param (like YouTube's ?v=) does.

Example ​

ts
// Don't re-run when switching tabs within the same repo.
  key: (url) => url.pathname.split('/').slice(0, 3).join('/');

Parameters ​

▪ url: URL

Source ​

packages/wxt/src/types.ts:846


Generated using typedoc-plugin-markdown and TypeDoc