All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
18 lines
577 B
JavaScript
18 lines
577 B
JavaScript
import canUsePassiveEventListeners from './canUsePassiveEventListeners';
|
|
|
|
export default function normalizeEventOptions(eventOptions) {
|
|
if (!eventOptions) {
|
|
return undefined;
|
|
}
|
|
|
|
if (!canUsePassiveEventListeners()) {
|
|
// If the browser does not support the passive option, then it is expecting
|
|
// a boolean for the options argument to specify whether it should use
|
|
// capture or not. In more modern browsers, this is passed via the `capture`
|
|
// option, so let's just hoist that value up.
|
|
return !!eventOptions.capture;
|
|
}
|
|
|
|
return eventOptions;
|
|
}
|