@zag-js/dom-utils
Advanced tools
Comparing version 0.0.0-dev-20221015100745 to 0.0.0-dev-20221015102437
@@ -210,2 +210,3 @@ import { JSX } from '@zag-js/types'; | ||
createEmitter: (ctx: Ctx, target: HTMLElement) => (evt: string, detail: Record<string, any>, options?: EventInit) => void; | ||
createListener: (target: HTMLElement) => <T_2 = any>(evt: string, handler: (e: CustomEvent<T_2>) => void) => () => void; | ||
} & T; | ||
@@ -212,0 +213,0 @@ declare function contains(parent: HTMLElement | EventTarget | null | undefined, child: HTMLElement | EventTarget | null): boolean; |
@@ -307,2 +307,10 @@ "use strict"; | ||
}; | ||
}, | ||
createListener: (target) => { | ||
return function listen(evt, handler) { | ||
const eventName = `zag:${evt}`; | ||
const listener = (e) => handler(e); | ||
target.addEventListener(eventName, listener); | ||
return () => target.removeEventListener(eventName, listener); | ||
}; | ||
} | ||
@@ -309,0 +317,0 @@ }; |
{ | ||
"name": "@zag-js/dom-utils", | ||
"version": "0.0.0-dev-20221015100745", | ||
"version": "0.0.0-dev-20221015102437", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84427
2434