廖井涛
2024-04-25 75d73ce4102d3cf229c6f4bbae34c32b807ebd31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
export const eventListenerOptionsSupported = () => {
  let supported = false;
 
  try {
    const opts = Object.defineProperty({}, 'passive', {
      get() {
        supported = true;
      }
    });
 
    window.addEventListener('test', null, opts);
    window.removeEventListener('test', null, opts);
  } catch (e) {}
 
  return supported;
}