Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/script-loader

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/script-loader - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

2

dist/index.d.ts

@@ -28,2 +28,2 @@ import { ComponentProps, Accessor } from 'solid-js';

export { ScriptProps, createScriptLoader };
export { type ScriptProps, createScriptLoader };

@@ -11,5 +11,22 @@ import { splitProps, createRenderEffect, onCleanup } from 'solid-js';

const script = document.createElement("script");
const [local, scriptProps] = splitProps(props, OMITTED_PROPS);
const eventKeys = Object.keys(props).filter((p) => p.startsWith("on"));
const [local, events, scriptProps] = splitProps(
props,
OMITTED_PROPS,
eventKeys
);
setTimeout(() => spread(script, scriptProps, false, true));
createRenderEffect(() => {
Object.entries(events).forEach(
([name, handler]) => script.addEventListener(
/^on:?(.*)/.test(name) ? name.startsWith("on:") ? RegExp.$1 : RegExp.$1.toLowerCase() : name,
(ev) => {
Object.defineProperties(ev, {
target: { value: script, enumerable: true },
currentTarget: { value: script, enumerable: true }
});
Array.isArray(handler) ? handler[0](handler[1], ev) : typeof handler === "function" && handler?.call(null, Object.assign(ev));
}
)
);
const src = typeof local.src === "string" ? local.src : local.src();

@@ -16,0 +33,0 @@ const prop = /^(https?:|\w[\.\w-_%]+|)\//.test(src) ? "src" : "textContent";

{
"name": "@solid-primitives/script-loader",
"version": "2.1.2",
"version": "2.2.0",
"description": "Primitive to load scripts dynamically",

@@ -5,0 +5,0 @@ "author": "Alex Lohr <alex.lohr@logmein.com>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc