Skip to content

API > wxt/utils/inject-script > InjectScriptOptions

Interface: InjectScriptOptions

Contents

Properties

keepInDom

keepInDom?: boolean

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

Source

packages/wxt/src/utils/inject-script.ts:86


modifyScript

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

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

Source

packages/wxt/src/utils/inject-script.ts:94


Generated using typedoc-plugin-markdown and TypeDoc