web-ui-pack
Version:
Web package with UI elements
10 lines (9 loc) • 647 B
TypeScript
import onFocusLost from "./onFocusLost";
/** Fires when element or children gotFocus (happens once)
* Depsite on focusin onFocusGot event isn't called several times on children inside element
* @param {HTMLElement} element HTMLElement to apply `.addEventListener`
* @param {Function} listener Callback invoked on event
* @param options OnFocusLostOptions. onFocusGot depends on onFocusLost
* @return dispose() function. Call it to remove listener
* */
export default function onFocusGot(element: HTMLElement, listener: (this: HTMLElement, ev: HTMLElementEventMap["focusin"]) => any, options?: Parameters<typeof onFocusLost>[2]): () => void;