
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@solid-primitives/script-loader
Advanced tools
Creates a primitive to load scripts dynamically, either for external services or jsonp requests
npm install @solid-primitives/script-loader
# or
yarn add @solid-primitives/script-loader
const [script: HTMLScriptElement, remove: () => void] = createScriptLoader({
src: string | Accessor<string>, // url or js source
type?: string,
onload?: () => void,
onerror?: () => void
});
// For example, to use recaptcha:
createScriptLoader({
src: 'https://www.google.com/recaptcha/enterprise.js?render=my_token'
onload: async () => {
await grecaptcha.enterprise.ready();
const token = await grecaptcha.enterprise.execute('my_token', {action: 'login'});
// do your stuff...
}
});
// or pinterest embeds:
const pinterestEmbedScript = '!function(a,b,c){var d,e,f;d="PIN_"+~~((new Date).getTime()/864e5),...';
createScriptLoader({
src: pinterestEmbedScript,
onload: () => window?.PinUtils?.build()
});
TODO
0.0.100
Initial release.
1.0.2
Release first first with CJS support.
1.0.3
Upgrade to Solid 1.3
1.0.4
Support JS source inclusion.
FAQs
Primitive to load scripts dynamically
The npm package @solid-primitives/script-loader receives a total of 1,600 weekly downloads. As such, @solid-primitives/script-loader popularity was classified as popular.
We found that @solid-primitives/script-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.