MCPcopy
hub / github.com/dolphin-wood/smooth-scrollbar / getOptions

Function getOptions

src/utils/event-hub.ts:17–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15const eventMap = new WeakMap<Scrollbar, EventConfig[]>();
16
17function getOptions(): typeof eventListenerOptions {
18 if (eventListenerOptions !== undefined) {
19 return eventListenerOptions;
20 }
21
22 let supportPassiveEvent = false;
23
24 try {
25 const noop = () => {};
26 const options = Object.defineProperty({}, 'passive', {
27 enumerable: true,
28 get() {
29 supportPassiveEvent = true;
30 return true;
31 },
32 });
33 window.addEventListener('testPassive', noop, options);
34 window.removeEventListener('testPassive', noop, options);
35 } catch (e) {}
36
37 eventListenerOptions = supportPassiveEvent ? { passive: false } as EventListenerOptions : false;
38
39 return eventListenerOptions;
40}
41
42export function eventScope(scrollbar: Scrollbar) {
43 const configs = eventMap.get(scrollbar) || [];

Callers 2

eventScopeFunction · 0.85
clearEventsOnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…