
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
@dschz/solid-create-script
Advanced tools
SolidJS hook to load external scripts -- built on top of
@dschz/load-script
.
@dschz/load-script
inheriting all the same features.createResource
npm install solid-js @dschz/load-script @dschz/solid-create-script
pnpm install solid-js @dschz/load-script @dschz/solid-create-script
yarn install solid-js @dschz/load-script @dschz/solid-create-script
bun install solid-js @dschz/load-script @dschz/solid-create-script
These are peer dependencies, so you must install:
solid-js
@dschz/load-script
createScript(src, options?, container?)
Loads an external script dynamically and returns a Resource<HTMLScriptElement>
.
Name | Type | Description |
---|---|---|
src | string | Script URL (required) |
options | LoadScriptOptions | loadScript options (e.g. async , type ) |
container | HTMLElement | HTML element to append <script /> to (default: document.head ) |
import { Switch, Match } from "solid-js";
import { createScript } from "@dschz/solid-create-script";
const CustomComponent = () => {
const script = createScript("https://example.com/widget.js", { async: true });
return (
<Switch>
<Match when={script.loading}>Loading Script...</Match>
<Match when={script.error}>Failed to load</Match>
<Match when={script()}>Script is ready!</Match>
</Switch>
);
};
src
unless innerHTML
or textContent
is usedFeel free to open issues or submit pull requests. PRs are welcome!
FAQs
Solid utility hook to dynamically load an external script.
We found that @dschz/solid-create-script demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.