Script | useWeb (original) (raw)

This function allows you to add a custom third-party script to the DOM.

# State

The useScript function exposes the following reactive state:

State Type Description
isLoading Boolean If the script is still downloading.
error Boolean If the script didn't download correctly.

# Methods

useScript exposes a toPromise method that returns a promise when the script loads successfully.

# Config

useScript function takes an options object, the object must contain a src property.

Config Type Description
src String The 3rd party script URL.

# Example

This example implements a Stripe elements example.