Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 1x 1x | // via https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#safely_detecting_option_support let supportsPassiveEvents = false; try { const options = { get passive() { // This function will be called when the browser // attempts to access the passive property. supportsPassiveEvents = true; return false; }, }; window.addEventListener("test", null, options); window.removeEventListener( "test" as keyof WindowEventMap, null, options as EventListenerOptions ); } catch (err) { supportsPassiveEvents = false; } export { supportsPassiveEvents }; |