@tanstack/hotkeys
Version:
Type-safe, framework-agnostic keyboard hotkey management for the browser
14 lines (13 loc) • 678 B
JavaScript
// src/_listen.ts
/**
* Adds a listener with the native method. zone.js runs all the listeners it
* patches for one type and phase on a node from one native listener, added
* with the options of the first, so after a passive one `preventDefault`
* would fail. zone.js keeps the native method under its symbol prefix,
* `__zone_symbol__` unless the page sets `__Zone_symbol_prefix`, and its
* patched `removeEventListener` falls back to the native one.
*/
function listen(target, type, listener, capture) {
(target[`${globalThis.__Zone_symbol_prefix ?? "__zone_symbol__"}addEventListener`] ?? target.addEventListener).call(target, type, listener, capture);
}
export { listen };