🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@byelabel/react

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@byelabel/react - npm Package Compare versions

Comparing version
0.0.5
to
0.0.6
+1
-0
build/hooks/useScript.d.ts

@@ -6,4 +6,5 @@ export type ScriptStatus = 'idle' | 'loading' | 'ready' | 'error';

position?: ScriptPosition;
attributes?: Record<string, string>;
};
export default function useScript(src: string, options?: UseScriptOptions): ScriptStatus;
//# sourceMappingURL=useScript.d.ts.map
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"useScript.d.ts","sourceRoot":"","sources":["../../src/hooks/useScript.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;AAEnF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,YAAY,CAoDvF"}
{"version":3,"file":"useScript.d.ts","sourceRoot":"","sources":["../../src/hooks/useScript.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;AAEnF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,YAAY,CA2DvF"}
import { useEffect, useState } from 'react';
export default function useScript(src, options) {
const { enable = true, position = 'body-end' } = options ?? {};
const { enable = true, position = 'body-end', attributes = null } = options ?? {};
const [status, setStatus] = useState(src ? 'loading' : 'idle');

@@ -19,2 +19,8 @@ useEffect(() => {

script.setAttribute('data-status', 'loading');
// Extra attributes (e.g. data-api-key for Shopify App Bridge)
if (attributes) {
for (const [name, value] of Object.entries(attributes)) {
script.setAttribute(name, value);
}
}
if (position === 'head-start') {

@@ -21,0 +27,0 @@ document.head.insertBefore(script, document.head.childNodes[0]);

{
"name": "@byelabel/react",
"version": "0.0.5",
"version": "0.0.6",
"description": "ByeLabel React utilities (hooks, contexts)",

@@ -5,0 +5,0 @@ "type": "module",