mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] runtime: improve useExternalListener typing
Previously the type of the target for useExternalListener was HTMLElement or Window, this makes document an invalid target. Here there is no reason to use the EventTarget interface instead, as useExternalListener only uses methods from that interface and should work with any event target. Closes odoo/owl#1323
This commit is contained in:
committed by
Géry Debongnie
parent
316eb06279
commit
a69f8a39e7
@@ -117,7 +117,7 @@ export function useEffect(effect: Effect, computeDependencies: () => any[] = ()
|
||||
* `useExternalListener(window, 'click', this._doSomething);`
|
||||
* */
|
||||
export function useExternalListener(
|
||||
target: HTMLElement | typeof window,
|
||||
target: EventTarget,
|
||||
eventName: string,
|
||||
handler: EventListener,
|
||||
eventParams?: AddEventListenerOptions
|
||||
|
||||
Reference in New Issue
Block a user