@loadsmart/miranda-wc
Version:
Miranda Web Components component library
30 lines (29 loc) • 1.01 kB
TypeScript
/**
* Re-dispatches an event from the provided element.
*
* This function is useful for forwarding non-composed events, such as `change`
* events.
*
* @example
* class MyInput extends LitElement {
* render() {
* return html`<input @change=${this.redispatchEvent}>`;
* }
*
* protected redispatchEvent(event: Event) {
* redispatchEvent(this, event);
* }
* }
*
* Source: https://github.com/material-components/material-web/blob/c633e85192b20d7ad0930f131957ecefbb8a2f96/controller/events.ts
*
* @param element The element to dispatch the event from.
* @param event The event to re-dispatch.
* @return Whether or not the event was dispatched (if cancelable).
*/
export declare function redispatchEvent(element: Element, event: Event): boolean;
/**
* Check if `event` happened on the given `element`.
* @returns `true` if the event happened on the given element, `false` otherwise.
*/
export declare function isInsideElement(event: Event, element: HTMLElement): boolean;