@sigil-dev/runtime 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +3 -2
- package/jsr.json +1 -1
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -410,8 +410,9 @@ export function insert(parent: Element, value: unknown): void {
|
|
|
410
410
|
*/
|
|
411
411
|
export type Directive = (node: Element, params: unknown) => void | (() => void);
|
|
412
412
|
|
|
413
|
-
export function applyDirective(node: Element, directive: Directive,
|
|
414
|
-
const
|
|
413
|
+
export function applyDirective(node: Element, directive: Directive | [Directive, unknown]): void {
|
|
414
|
+
const [fn, params] = Array.isArray(directive) ? directive : [directive, undefined];
|
|
415
|
+
const cleanup = fn(node, params);
|
|
415
416
|
if (typeof cleanup === "function") {
|
|
416
417
|
createEffect(() => () => cleanup());
|
|
417
418
|
}
|
package/jsr.json
CHANGED