API / wxt / SpaContentScriptOptions
Interface: SpaContentScriptOptions
Source: packages/wxt/src/types.ts:834
See BaseContentScriptEntrypointOptions.spa.
Properties
key?
optionalkey?: (url) =>string
Source: packages/wxt/src/types.ts:846
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.
Parameters
url
URL
Returns
string
Example
ts
// Don't re-run when switching tabs within the same repo.
key: (url) => url.pathname.split('/').slice(0, 3).join('/');Generated using typedoc-plugin-markdown and TypeDoc