import isBrowser from '../../isBrowser';
import memorize from '../../memorize-one';
function testPassiveEventListeners() {
    if (!isBrowser) {
        return false;
    }
    if (!window.addEventListener ||
        !window.removeEventListener ||
        !Object.defineProperty) {
        return false;
    }
    var supportsPassiveOption = false;
    try {
        var opts = Object.defineProperty({}, 'passive', {
            get: function () {
                supportsPassiveOption = true;
                return true;
            },
        });
        var noop = function () { };
        window.addEventListener('testPassiveEventSupport', noop, opts);
        window.removeEventListener('testPassiveEventSupport', noop, opts);
    }
    catch (e) {
    }
    return supportsPassiveOption;
}
export var canUsePassiveEventListeners = memorize(testPassiveEventListeners);
