Skip to content

API / wxt/utils/inject-script / InjectScriptOptions

Interface: InjectScriptOptions

Source: packages/wxt/src/utils/inject-script.ts:80

Contents

Properties

keepInDom?

optional keepInDom?: boolean

Source: packages/wxt/src/utils/inject-script.ts:85

By default, the injected script is removed from the DOM after being injected. To disable this behavior, set this flag to true.


modifyScript?

optional modifyScript?: (script) => void | Promise<void>

Source: packages/wxt/src/utils/inject-script.ts:93

Modify the script element just before it is added to the DOM.

It can be used to e.g. modify script.async/script.defer, add event listeners to the element, or pass data to the script via script.dataset (which can be accessed by the script via document.currentScript).

Parameters

script

HTMLScriptElement

Returns

void | Promise<void>


Generated using typedoc-plugin-markdown and TypeDoc