Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/netzo/deps/usehooks-ts.ts>useScript

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useScript
import { useScript } from "https://deno.land/x/netzo@0.5.67/deps/usehooks-ts.ts";

Custom hook for dynamically loading scripts and tracking their loading status.

Examples

const scriptStatus = useScript('https://example.com/script.js', { removeOnUnmount: true }); // Access the status of the script loading (e.g., 'loading', 'ready', 'error').

Parameters

src: string | null
  • The source URL of the script to load. Set to null or omit to prevent loading (optional).
optional
options: UseScriptOptions
  • Additional options for controlling script loading (optional).

Returns

The status of the script loading, which can be one of 'idle', 'loading', 'ready', or 'error'.