mirror of
https://github.com/jaandrle/deka-dom-el
synced 2024-11-21 15:39:36 +01:00
dispatchEvent
This commit is contained in:
parent
a2b4e19d1b
commit
56206343d1
14
dist/dde-with-signals.js
vendored
14
dist/dde-with-signals.js
vendored
File diff suppressed because one or more lines are too long
2
dist/dde.js
vendored
2
dist/dde.js
vendored
File diff suppressed because one or more lines are too long
2
dist/esm-with-signals.d.ts
vendored
2
dist/esm-with-signals.d.ts
vendored
@ -96,6 +96,8 @@ export function chainableAppend<EL extends SupportedElement>(el: EL): EL;
|
||||
|
||||
export function dispatchEvent(name: keyof DocumentEventMap | string, options?: EventInit):
|
||||
(element: SupportedElement, data?: any)=> void;
|
||||
export function dispatchEvent(name: keyof DocumentEventMap | string, options: EventInit | null, element: SupportedElement | (()=> SupportedElement)):
|
||||
(data?: any)=> void;
|
||||
interface On{
|
||||
/** Listens to the DOM event. See {@link Document.addEventListener} */
|
||||
<
|
||||
|
8
dist/esm-with-signals.js
vendored
8
dist/esm-with-signals.js
vendored
File diff suppressed because one or more lines are too long
2
dist/esm.d.ts
vendored
2
dist/esm.d.ts
vendored
@ -96,6 +96,8 @@ export function chainableAppend<EL extends SupportedElement>(el: EL): EL;
|
||||
|
||||
export function dispatchEvent(name: keyof DocumentEventMap | string, options?: EventInit):
|
||||
(element: SupportedElement, data?: any)=> void;
|
||||
export function dispatchEvent(name: keyof DocumentEventMap | string, options: EventInit | null, element: SupportedElement | (()=> SupportedElement)):
|
||||
(data?: any)=> void;
|
||||
interface On{
|
||||
/** Listens to the DOM event. See {@link Document.addEventListener} */
|
||||
<
|
||||
|
2
dist/esm.js
vendored
2
dist/esm.js
vendored
File diff suppressed because one or more lines are too long
2
index.d.ts
vendored
2
index.d.ts
vendored
@ -95,6 +95,8 @@ export function chainableAppend<EL extends SupportedElement>(el: EL): EL;
|
||||
|
||||
export function dispatchEvent(name: keyof DocumentEventMap | string, options?: EventInit):
|
||||
(element: SupportedElement, data?: any)=> void;
|
||||
export function dispatchEvent(name: keyof DocumentEventMap | string, options: EventInit | null, element: SupportedElement | (()=> SupportedElement)):
|
||||
(data?: any)=> void;
|
||||
interface On{
|
||||
/** Listens to the DOM event. See {@link Document.addEventListener} */
|
||||
<
|
||||
|
@ -1,7 +1,12 @@
|
||||
export { registerReactivity } from './signals-common.js';
|
||||
|
||||
export function dispatchEvent(name, options= {}){
|
||||
export function dispatchEvent(name, options, host){
|
||||
if(!options) options= {};
|
||||
return function dispatch(element, ...d){
|
||||
if(host){
|
||||
d.unshift(element);
|
||||
element= typeof host==="function"? host() : host;
|
||||
}
|
||||
const event= d.length ? new CustomEvent(name, Object.assign({ detail: d[0] }, options)) : new Event(name, options);
|
||||
return element.dispatchEvent(event);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user