Socket
Socket
Sign inDemoInstall

events-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

events-polyfill - npm Package Compare versions

Comparing version 2.1.0 to 2.1.2

8

index.js

@@ -1,2 +0,2 @@

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
module.exports = (function() {

@@ -85,3 +85,3 @@

EventListenerInterceptor.normalizeListenerCallback = function(listener) {
if(typeof listener === 'function') {
if((typeof listener === 'function') || (listener === null) || (listener === void 0)) {
return listener;

@@ -107,2 +107,5 @@ } else if((typeof listener === 'object') && (typeof listener.handleEvent === 'function')) {

case 'object':
if (options === null) {
options = { capture: false };
}
break;

@@ -250,2 +253,3 @@ default:

})();
},{}],2:[function(require,module,exports){

@@ -252,0 +256,0 @@ (function(EventListenerInterceptor) {

@@ -1,1 +0,1 @@

(function o(s,p,l){function a(n,e){if(!p[n]){if(!s[n]){var t=typeof require=="function"&&require;if(!e&&t)return t(n,!0);if(u)return u(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var r=p[n]={exports:{}};s[n][0].call(r.exports,function(e){var t=s[n][1][e];return a(t?t:e)},r,r.exports,o,s,p,l)}return p[n].exports}var u=typeof require=="function"&&require;for(var e=0;e<l.length;e++)a(l[e]);return a})({1:[function(e,t,n){t.exports=function(){if(typeof EventTarget==="undefined"){window.EventTarget=Node}var e={interceptors:[]};e.getRegisteredEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){return i[r]}}}return null};e.registerEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners===void 0){e.__eventListeners={}}if(e.__eventListeners[n]===void 0){e.__eventListeners[n]=[]}e.__eventListeners[n].push(t)};e.unregisterEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){i.splice(r,1)}}if(i.length===0){delete e.__eventListeners[n]}}};e.normalizeListenerCallback=function(t){if(typeof t==="function"){return t}else if(typeof t==="object"&&typeof t.handleEvent==="function"){return t.handleEvent}else{return function(e){t(e)}}};e.normalizeListenerOptions=function(e){switch(typeof e){case"boolean":e={capture:e};break;case"undefined":e={capture:false};break;case"object":break;default:throw new Error("Unsupported options type for addEventListener")}e.once=Boolean(e.once);e.passive=Boolean(e.passive);e.capture=Boolean(e.capture);return e};e.normalizeListenerArguments=function(e,t,n){return{type:e,listener:this.normalizeListenerCallback(t),options:this.normalizeListenerOptions(n)}};e.intercept=function(e,t){var n=null;for(var i=0;i<this.interceptors.length;i++){if(this.interceptors[i].target===e){n=this.interceptors[i]}}if(n===null){n={target:e,interceptors:[t]};this.interceptors.push(n);this.interceptAddEventListener(e,n);this.interceptRemoveEventListener(e,n)}else{n.interceptors.push(t)}};e.interceptAddEventListener=function(e,p){var l=this;var a=e.prototype.addEventListener;e.prototype.addEventListener=function(e,t,n){var i=l.normalizeListenerArguments(e,t,n);var r=l.getRegisteredEventListener(this,i);if(!r){i.polyfilled={type:i.type,listener:i.listener,options:{capture:i.options.capture,once:i.options.once,passive:i.options.passive}};for(var o=0;o<p.interceptors.length;o++){var s=p.interceptors[o];if(typeof s.add==="function"){s.add(i)}}l.registerEventListener(this,i);a.call(this,i.polyfilled.type,i.polyfilled.listener,i.polyfilled.options)}};return function(){e.prototype.addEventListener=a}};e.interceptRemoveEventListener=function(e,t){var o=this;var s=e.prototype.removeEventListener;e.prototype.removeEventListener=function(e,t,n){var i=o.normalizeListenerArguments(e,t,n);var r=o.getRegisteredEventListener(this,i);if(r){o.unregisterEventListener(this,i);s.call(this,r.polyfilled.type,r.polyfilled.listener,r.polyfilled.options)}else{s.call(this,e,t,n)}};return function(){e.prototype.removeEventListener=s}};e.interceptAll=function(e){this.intercept(EventTarget,e);if(!(window instanceof EventTarget)){this.intercept(Window,e)}};e.releaseAll=function(){for(var e=0,t=this.interceptors.length;e<t;e++){this.interceptors()}};e.error=function(e){console.error(e)};return e}()},{}],2:[function(e,t,n){(function(n){n.isSupportedOnEvent=function(e,t){return"on"+t in e};n.isSupportedTransitionEvent=function(e,t){return n.isSupportedOnEvent(e,t)||"style"in e&&e.style["transition"]!==void 0};n.isSupportedFullScreenEvent=function(e,t){if(n.isSupportedOnEvent(e,t)){return true}else{if(/^ms/.test(t.toLowerCase())){return"msRequestFullscreen"in document.body}else if(/^moz/.test(t)){return"mozRequestFullscreen"in document.body}else if(/^webkit/.test(t)){return"webkitRequestFullscreen"in document.body}else{return false}}};n.generateEventTypes=function(){var n=this;this.eventTypes={};this.vendorPrefixes=["","webkit","moz","ms","o"];this.eventTypes["wheel"]=["wheel","mousewheel","DOMMouseScroll"].map(function(e){return{type:e,isSupported:n.isSupportedOnEvent}});this.eventTypes["fullscreenchange"]=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","MSFullscreenChange","msfullscreenchange"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});this.eventTypes["fullscreenerror"]=["fullscreenerror","mozfullscreenerror","webkitfullscreenerror","MSFullscreenError","msfullscreenerror"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});["pointerlockchange","pointerlockerror","animationstart","animationiteration","animationend","pointercancel","pointerdown","pointerhover","pointermove","pointerout","pointerover","pointerup"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedOnEvent}})});["transitionstart","transitionrun","transitionend"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedTransitionEvent}})})};n.getSupportedEventType=function(e,t){var n=this.eventTypes[t];if(n===void 0){return t}else{var i;for(var r=0;r<n.length;r++){i=n[r];if(i.isSupported(e,i.type)){return i.type}}return t}};n.polyfillListenerEventTypes=function(){this.generateEventTypes();var t=this;this.interceptAll({add:function(e){e.polyfilled.type=t.getSupportedEventType(this,e.polyfilled.type)}})};n.polyfillListenerEventTypes()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],3:[function(e,t,n){(function(e){e.detectSupportedOptions=function(){var e=this;this.supportedOptions={once:false,passive:false,capture:false,all:false,some:false};document.createDocumentFragment().addEventListener("test",function(){},{get once(){e.supportedOptions.once=true;return false},get passive(){e.supportedOptions.passive=true;return false},get capture(){e.supportedOptions.capture=true;return false}});this.supportedOptions.all=this.supportedOptions.once&&this.supportedOptions.passive&&this.supportedOptions.capture;this.supportedOptions.some=this.supportedOptions.once||this.supportedOptions.passive||this.supportedOptions.capture};e.polyfillListenerOptions=function(){this.detectSupportedOptions();if(!this.supportedOptions.all){var e=this;this.interceptAll({add:function(t){var n=t.options.once&&!e.supportedOptions.once;var i=t.options.passive&&!e.supportedOptions.passive;if(n||i){var r=t.polyfilled.listener;t.polyfilled.listener=function(e){if(n){this.removeEventListener(t.type,t.listener,t.options)}if(i){e.preventDefault=function(){throw new Error("Unable to preventDefault inside passive event listener invocation.")}}return r.call(this,e)}}if(!e.supportedOptions.some){t.polyfilled.options=t.options.capture}}})}};e.polyfillListenerOptions()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],4:[function(e,t,n){t.exports=function(){return function e(t,n){if(typeof n==="object"&&n!==null){var i=Object.getPrototypeOf(n);var r;for(r in i){if(!(r in t)){var o=Object.getOwnPropertyDescriptor(i,r);if(o){Object.defineProperty(t,r,o)}}}for(r in n){if(!(r in t)){t[r]=n[r]}}}}}()},{}],5:[function(e,t,n){(function(i){try{var e=new window.CustomEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.CustomEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");n.initCustomEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);i(n,this);return n};n.prototype=t.prototype;window.CustomEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],6:[function(e,t,n){(function(i){try{var e=new window.Event("event",{bubbles:true,cancelable:true})}catch(e){var t=window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("Event");n.initEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);i(n,this);return n};n.prototype=t.prototype;window.Event=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],7:[function(e,t,n){(function(i){try{var e=new window.FocusEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.FocusEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("FocusEvent");n.initFocusEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?{}:t.detail,t.relatedTarget===void 0?null:t.relatedTarget);i(n,this);return n};n.prototype=t.prototype;window.FocusEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],8:[function(e,t,n){(function(i){try{var e=new window.KeyboardEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.KeyboardEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("KeyboardEvent");n.initKeyboardEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.key===void 0?"":t.key,t.location===void 0?0:t.location,(t.ctrlKey===true?"Control ":"")+(t.altKey===true?"Alt ":"")+(t.shiftKey===true?"Shift ":"")+(t.metaKey===true?"Meta ":""),t.repeat===void 0?false:t.repeat,t.locale===void 0?navigator.language:t.locale);n.keyCode=t.keyCode===void 0?0:t.keyCode;n.code=t.code===void 0?"":t.code;n.charCode=t.charCode===void 0?0:t.charCode;n.char=t.charCode===void 0?"":t.charCode;n.which=t.which===void 0?0:t.which;i(n,this);return n};n.prototype=t.prototype;window.KeyboardEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],9:[function(e,t,n){(function(i){try{var e=new window.MouseEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.MouseEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("MouseEvent");n.initMouseEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?0:t.detail,t.screenX===void 0?0:t.screenX,t.screenY===void 0?0:t.screenY,t.clientX===void 0?0:t.clientX,t.clientY===void 0?0:t.clientY,t.ctrlKey===void 0?false:t.ctrlKey,t.altKey===void 0?false:t.altKey,t.shiftKey===void 0?false:t.shiftKey,t.metaKey===void 0?false:t.metaKey,t.button===void 0?0:t.button,t.relatedTarget===void 0?null:t.relatedTarget);n.buttons=t.buttons===void 0?0:t.buttons;n.region=t.region===void 0?null:t.region;i(n,this);return n};n.prototype=t.prototype;window.MouseEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],10:[function(e,t,n){(function(i){try{var e=new window.PointerEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.PointerEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("PointerEvent");n.initPointerEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?0:t.detail,t.screenX===void 0?0:t.screenX,t.screenY===void 0?0:t.screenY,t.clientX===void 0?0:t.clientX,t.clientY===void 0?0:t.clientY,t.ctrlKey===void 0?false:t.ctrlKey,t.altKey===void 0?false:t.altKey,t.shiftKey===void 0?false:t.shiftKey,t.metaKey===void 0?false:t.metaKey,t.button===void 0?0:t.button,t.relatedTarget===void 0?null:t.relatedTarget,t.offsetX===void 0?0:t.offsetX,t.offsetY===void 0?0:t.offsetY,t.width===void 0?1:t.width,t.height===void 0?1:t.height,t.pressure===void 0?0:t.pressure,t.twist===void 0?0:t.twist,t.tiltX===void 0?0:t.tiltX,t.tiltY===void 0?0:t.tiltY,t.pointerId===void 0?0:t.pointerId,t.pointerType===void 0?"":t.pointerType,t.hwTimestamp===void 0?0:t.hwTimestamp,t.isPrimary===void 0?false:t.isPrimary);n.tangentialPressure=t.tangentialPressure===void 0?0:t.tangentialPressure;i(n,this);return n};n.prototype=t.prototype;var r=Object.getOwnPropertyDescriptor(n.prototype,"rotation");if(r){Object.defineProperty(n.prototype,"twist",r)}window.PointerEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],11:[function(e,t,n){e("./Event.js");e("./CustomEvent.js");e("./MouseEvent.js");e("./KeyboardEvent.js");e("./FocusEvent.js");e("./PointerEvent.js")},{"./CustomEvent.js":5,"./Event.js":6,"./FocusEvent.js":7,"./KeyboardEvent.js":8,"./MouseEvent.js":9,"./PointerEvent.js":10}],12:[function(e,t,n){e("./constructors/index.js");e("./ListenerOptions.js");e("./ListenerEventTypes.js")},{"./ListenerEventTypes.js":2,"./ListenerOptions.js":3,"./constructors/index.js":11}]},{},[12]);
(function(){function u(o,s,p){function l(n,e){if(!s[n]){if(!o[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(a)return a(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var r=s[n]={exports:{}};o[n][0].call(r.exports,function(e){var t=o[n][1][e];return l(t||e)},r,r.exports,u,o,s,p)}return s[n].exports}for(var a="function"==typeof require&&require,e=0;e<p.length;e++)l(p[e]);return l}return u})()({1:[function(e,t,n){t.exports=function(){if(typeof EventTarget==="undefined"){window.EventTarget=Node}var e={interceptors:[]};e.getRegisteredEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){return i[r]}}}return null};e.registerEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners===void 0){e.__eventListeners={}}if(e.__eventListeners[n]===void 0){e.__eventListeners[n]=[]}e.__eventListeners[n].push(t)};e.unregisterEventListener=function(e,t){var n=t.type+"-"+(t.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[n]!==void 0){var i=e.__eventListeners[n];for(var r=0;r<i.length;r++){if(i[r].listener===t.listener){i.splice(r,1)}}if(i.length===0){delete e.__eventListeners[n]}}};e.normalizeListenerCallback=function(t){if(typeof t==="function"||t===null||t===void 0){return t}else if(typeof t==="object"&&typeof t.handleEvent==="function"){return t.handleEvent}else{return function(e){t(e)}}};e.normalizeListenerOptions=function(e){switch(typeof e){case"boolean":e={capture:e};break;case"undefined":e={capture:false};break;case"object":if(e===null){e={capture:false}}break;default:throw new Error("Unsupported options type for addEventListener")}e.once=Boolean(e.once);e.passive=Boolean(e.passive);e.capture=Boolean(e.capture);return e};e.normalizeListenerArguments=function(e,t,n){return{type:e,listener:this.normalizeListenerCallback(t),options:this.normalizeListenerOptions(n)}};e.intercept=function(e,t){var n=null;for(var i=0;i<this.interceptors.length;i++){if(this.interceptors[i].target===e){n=this.interceptors[i]}}if(n===null){n={target:e,interceptors:[t]};this.interceptors.push(n);this.interceptAddEventListener(e,n);this.interceptRemoveEventListener(e,n)}else{n.interceptors.push(t)}};e.interceptAddEventListener=function(e,p){var l=this;var a=e.prototype.addEventListener;e.prototype.addEventListener=function(e,t,n){var i=l.normalizeListenerArguments(e,t,n);var r=l.getRegisteredEventListener(this,i);if(!r){i.polyfilled={type:i.type,listener:i.listener,options:{capture:i.options.capture,once:i.options.once,passive:i.options.passive}};for(var o=0;o<p.interceptors.length;o++){var s=p.interceptors[o];if(typeof s.add==="function"){s.add(i)}}l.registerEventListener(this,i);a.call(this,i.polyfilled.type,i.polyfilled.listener,i.polyfilled.options)}};return function(){e.prototype.addEventListener=a}};e.interceptRemoveEventListener=function(e,t){var o=this;var s=e.prototype.removeEventListener;e.prototype.removeEventListener=function(e,t,n){var i=o.normalizeListenerArguments(e,t,n);var r=o.getRegisteredEventListener(this,i);if(r){o.unregisterEventListener(this,i);s.call(this,r.polyfilled.type,r.polyfilled.listener,r.polyfilled.options)}else{s.call(this,e,t,n)}};return function(){e.prototype.removeEventListener=s}};e.interceptAll=function(e){this.intercept(EventTarget,e);if(!(window instanceof EventTarget)){this.intercept(Window,e)}};e.releaseAll=function(){for(var e=0,t=this.interceptors.length;e<t;e++){this.interceptors()}};e.error=function(e){console.error(e)};return e}()},{}],2:[function(e,t,n){(function(n){n.isSupportedOnEvent=function(e,t){return"on"+t in e};n.isSupportedTransitionEvent=function(e,t){return n.isSupportedOnEvent(e,t)||"style"in e&&e.style["transition"]!==void 0};n.isSupportedFullScreenEvent=function(e,t){if(n.isSupportedOnEvent(e,t)){return true}else{if(/^ms/.test(t.toLowerCase())){return"msRequestFullscreen"in document.body}else if(/^moz/.test(t)){return"mozRequestFullscreen"in document.body}else if(/^webkit/.test(t)){return"webkitRequestFullscreen"in document.body}else{return false}}};n.generateEventTypes=function(){var n=this;this.eventTypes={};this.vendorPrefixes=["","webkit","moz","ms","o"];this.eventTypes["wheel"]=["wheel","mousewheel","DOMMouseScroll"].map(function(e){return{type:e,isSupported:n.isSupportedOnEvent}});this.eventTypes["fullscreenchange"]=["fullscreenchange","mozfullscreenchange","webkitfullscreenchange","MSFullscreenChange","msfullscreenchange"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});this.eventTypes["fullscreenerror"]=["fullscreenerror","mozfullscreenerror","webkitfullscreenerror","MSFullscreenError","msfullscreenerror"].map(function(e){return{type:e,isSupported:n.isSupportedFullScreenEvent}});["pointerlockchange","pointerlockerror","animationstart","animationiteration","animationend","pointercancel","pointerdown","pointerhover","pointermove","pointerout","pointerover","pointerup"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedOnEvent}})});["transitionstart","transitionrun","transitionend"].forEach(function(t){n.eventTypes[t]=n.vendorPrefixes.map(function(e){return{type:e+t,isSupported:n.isSupportedTransitionEvent}})})};n.getSupportedEventType=function(e,t){var n=this.eventTypes[t];if(n===void 0){return t}else{var i;for(var r=0;r<n.length;r++){i=n[r];if(i.isSupported(e,i.type)){return i.type}}return t}};n.polyfillListenerEventTypes=function(){this.generateEventTypes();var t=this;this.interceptAll({add:function(e){e.polyfilled.type=t.getSupportedEventType(this,e.polyfilled.type)}})};n.polyfillListenerEventTypes()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],3:[function(e,t,n){(function(e){e.detectSupportedOptions=function(){var e=this;this.supportedOptions={once:false,passive:false,capture:false,all:false,some:false};document.createDocumentFragment().addEventListener("test",function(){},{get once(){e.supportedOptions.once=true;return false},get passive(){e.supportedOptions.passive=true;return false},get capture(){e.supportedOptions.capture=true;return false}});this.supportedOptions.all=this.supportedOptions.once&&this.supportedOptions.passive&&this.supportedOptions.capture;this.supportedOptions.some=this.supportedOptions.once||this.supportedOptions.passive||this.supportedOptions.capture};e.polyfillListenerOptions=function(){this.detectSupportedOptions();if(!this.supportedOptions.all){var e=this;this.interceptAll({add:function(t){var n=t.options.once&&!e.supportedOptions.once;var i=t.options.passive&&!e.supportedOptions.passive;if(n||i){var r=t.polyfilled.listener;t.polyfilled.listener=function(e){if(n){this.removeEventListener(t.type,t.listener,t.options)}if(i){e.preventDefault=function(){throw new Error("Unable to preventDefault inside passive event listener invocation.")}}return r.call(this,e)}}if(!e.supportedOptions.some){t.polyfilled.options=t.options.capture}}})}};e.polyfillListenerOptions()})(e("./EventListenerInterceptor.js"))},{"./EventListenerInterceptor.js":1}],4:[function(e,t,n){t.exports=function(){return function e(t,n){if(typeof n==="object"&&n!==null){var i=Object.getPrototypeOf(n);var r;for(r in i){if(!(r in t)){var o=Object.getOwnPropertyDescriptor(i,r);if(o){Object.defineProperty(t,r,o)}}}for(r in n){if(!(r in t)){t[r]=n[r]}}}}}()},{}],5:[function(e,t,n){(function(i){try{var e=new window.CustomEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.CustomEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");n.initCustomEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);i(n,this);return n};n.prototype=t.prototype;window.CustomEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],6:[function(e,t,n){(function(i){try{var e=new window.Event("event",{bubbles:true,cancelable:true})}catch(e){var t=window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("Event");n.initEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.detail===void 0?{}:t.detail);i(n,this);return n};n.prototype=t.prototype;window.Event=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],7:[function(e,t,n){(function(i){try{var e=new window.FocusEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.FocusEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("FocusEvent");n.initFocusEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?{}:t.detail,t.relatedTarget===void 0?null:t.relatedTarget);i(n,this);return n};n.prototype=t.prototype;window.FocusEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],8:[function(e,t,n){(function(i){try{var e=new window.KeyboardEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.KeyboardEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("KeyboardEvent");n.initKeyboardEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.key===void 0?"":t.key,t.location===void 0?0:t.location,(t.ctrlKey===true?"Control ":"")+(t.altKey===true?"Alt ":"")+(t.shiftKey===true?"Shift ":"")+(t.metaKey===true?"Meta ":""),t.repeat===void 0?false:t.repeat,t.locale===void 0?navigator.language:t.locale);n.keyCode=t.keyCode===void 0?0:t.keyCode;n.code=t.code===void 0?"":t.code;n.charCode=t.charCode===void 0?0:t.charCode;n.char=t.charCode===void 0?"":t.charCode;n.which=t.which===void 0?0:t.which;i(n,this);return n};n.prototype=t.prototype;window.KeyboardEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],9:[function(e,t,n){(function(i){try{var e=new window.MouseEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.MouseEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("MouseEvent");n.initMouseEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?0:t.detail,t.screenX===void 0?0:t.screenX,t.screenY===void 0?0:t.screenY,t.clientX===void 0?0:t.clientX,t.clientY===void 0?0:t.clientY,t.ctrlKey===void 0?false:t.ctrlKey,t.altKey===void 0?false:t.altKey,t.shiftKey===void 0?false:t.shiftKey,t.metaKey===void 0?false:t.metaKey,t.button===void 0?0:t.button,t.relatedTarget===void 0?null:t.relatedTarget);n.buttons=t.buttons===void 0?0:t.buttons;n.region=t.region===void 0?null:t.region;i(n,this);return n};n.prototype=t.prototype;window.MouseEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],10:[function(e,t,n){(function(i){try{var e=new window.PointerEvent("event",{bubbles:true,cancelable:true})}catch(e){var t=window.PointerEvent||window.Event;var n=function(e,t){t=t||{};var n=document.createEvent("PointerEvent");n.initPointerEvent(e,t.bubbles===void 0?false:t.bubbles,t.cancelable===void 0?false:t.cancelable,t.view===void 0?window:t.view,t.detail===void 0?0:t.detail,t.screenX===void 0?0:t.screenX,t.screenY===void 0?0:t.screenY,t.clientX===void 0?0:t.clientX,t.clientY===void 0?0:t.clientY,t.ctrlKey===void 0?false:t.ctrlKey,t.altKey===void 0?false:t.altKey,t.shiftKey===void 0?false:t.shiftKey,t.metaKey===void 0?false:t.metaKey,t.button===void 0?0:t.button,t.relatedTarget===void 0?null:t.relatedTarget,t.offsetX===void 0?0:t.offsetX,t.offsetY===void 0?0:t.offsetY,t.width===void 0?1:t.width,t.height===void 0?1:t.height,t.pressure===void 0?0:t.pressure,t.twist===void 0?0:t.twist,t.tiltX===void 0?0:t.tiltX,t.tiltY===void 0?0:t.tiltY,t.pointerId===void 0?0:t.pointerId,t.pointerType===void 0?"":t.pointerType,t.hwTimestamp===void 0?0:t.hwTimestamp,t.isPrimary===void 0?false:t.isPrimary);n.tangentialPressure=t.tangentialPressure===void 0?0:t.tangentialPressure;i(n,this);return n};n.prototype=t.prototype;var r=Object.getOwnPropertyDescriptor(n.prototype,"rotation");if(r){Object.defineProperty(n.prototype,"twist",r)}window.PointerEvent=n}})(e("./ApplyThisPrototype.js"))},{"./ApplyThisPrototype.js":4}],11:[function(e,t,n){e("./Event.js");e("./CustomEvent.js");e("./MouseEvent.js");e("./KeyboardEvent.js");e("./FocusEvent.js");e("./PointerEvent.js")},{"./CustomEvent.js":5,"./Event.js":6,"./FocusEvent.js":7,"./KeyboardEvent.js":8,"./MouseEvent.js":9,"./PointerEvent.js":10}],12:[function(e,t,n){e("./constructors/index.js");e("./ListenerOptions.js");e("./ListenerEventTypes.js")},{"./ListenerEventTypes.js":2,"./ListenerOptions.js":3,"./constructors/index.js":11}]},{},[12]);
{
"name": "events-polyfill",
"version": "2.1.0",
"version": "2.1.2",
"description": "Polyfill event : EventListener, EventTarget, Event, CustomEvent, MouseEvent, KeyboardEvent, FocusEvent, PointerEvent and add support for options (like 'once')",

@@ -21,3 +21,4 @@ "main": "index.js",

"devDependencies": {
"browserify": "latest",
"@types/node": "^10.12.18",
"browserify": "^16.2.3",
"http-server": "latest",

@@ -24,0 +25,0 @@ "selenium-webdriver": "^4.0.0-alpha.1",

@@ -84,3 +84,3 @@ module.exports = (function() {

EventListenerInterceptor.normalizeListenerCallback = function(listener) {
if(typeof listener === 'function') {
if((typeof listener === 'function') || (listener === null) || (listener === void 0)) {
return listener;

@@ -106,2 +106,5 @@ } else if((typeof listener === 'object') && (typeof listener.handleEvent === 'function')) {

case 'object':
if (options === null) {
options = { capture: false };
}
break;

@@ -248,2 +251,2 @@ default:

return EventListenerInterceptor;
})();
})();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc