Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 1.1.6 to 1.1.7

2

event-listener-polyfill.min.js

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

(function(){if(typeof EventTarget==="undefined"){window.EventTarget=Node}var e=["","webkit","moz","ms","o"];var n={wheel:["wheel","mousewheel","DOMMouseScroll"].map(function(e){return{type:e,test:l}})};var l=function(e,n){return"on"+n in e};var t=function(e,n){return l(e,n)||e.style["transition"]!==void 0};["pointerlockchange","pointerlockerror","fullscreenchange","fullscreenerror","animationstart","animationiteration","animationend","pointercancel","pointerdown","pointerhover","pointermove","pointerout","pointerover","pointerup"].forEach(function(t){n[t]=e.map(function(e){return{type:e+t,test:l}})});["transitionstart","transitionrun","transitionend"].forEach(function(l){n[l]=e.map(function(e){return{type:e+l,test:t}})});var u=function(e,l){var t=n[e];if(t===void 0){return e}else{var u=0;for(;u<t.length;u++){if(t[u].test(l,e)){return t[u].type}}if(u===t.length){throw new Error("Not supported type <"+e+">")}}};var r={once:false,passive:false,capture:false};document.createDocumentFragment().addEventListener("test",function(){},{get once(){r.once=true;return false},get passive(){r.passive=true;return false},get capture(){r.capture=true;return false}});r.all=r.once&&r.passive&&r.capture;r.some=r.once||r.passive||r.capture;var o=[null,null,null,null,null,null,null,null,"Backspace","Tab",null,null,"Numpad5","NumpadEnter",null,null,"ShiftLeft","ControlRight","AltRight","Pause","CapsLock",null,null,null,null,null,null,"Escape",null,null,null,null,"Space","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown",null,null,null,null,"Insert","Delete",null,"Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9",null,null,null,null,null,null,null,"KeyA","KeyB","KeyC","KeyD","KeyE","KeyF","KeyG","KeyH","KeyI","KeyJ","KeyK","KeyL","KeyM","KeyN","KeyO","KeyP","KeyQ","KeyR","KeyS","KeyT","KeyU","KeyV","KeyW","KeyX","KeyZ","KeyY","MetaLeft","MetaRight","ContextMenu",null,null,"Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadMultiply","NumpadAdd",null,"NumpadSubtract","NumpadDecimal","NumpadDivide","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"NumLock","ScrollLock",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"BracketLeft",null,"Comma","Slash","Period","Backquote","BracketRight",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Minus","Quote","Equal","Semicolon","Backslash",null,null,"IntlBackslash"];var i=function(e){if(typeof e==="function"){return e}else if(typeof e==="object"&&typeof e.handleEvent==="function"){return e.handleEvent}else{return function(n){e(n)}}};var a=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");break}e.once=typeof e.once==="boolean"?e.once:false;e.passive=typeof e.passive==="boolean"?e.passive:false;e.capture=typeof e.capture==="boolean"?e.capture:false;e.polyfill=typeof e.polyfill==="boolean"?e.polyfill:true;return e};var s=function(e,n,l){return{type:e,listener:i(n),options:a(l)}};var p=function(e,n){var l=n.type+"-"+(n.options.capture?"1":"0");if(e.__eventListeners===void 0){e.__eventListeners={}}if(e.__eventListeners[l]===void 0){e.__eventListeners[l]=[]}e.__eventListeners[l].push(n)};var c=function(e,n){var l=n.type+"-"+(n.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[l]!==void 0){var t=e.__eventListeners[l];for(var u=0;u<t.length;u++){if(t[u].listener===n.listener){t.splice(u,1)}}if(t.length===0){delete e.__eventListeners[l]}}};var f=function(e,n){var l=n.type+"-"+(n.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[l]!==void 0){var t=e.__eventListeners[l];for(var u=0;u<t.length;u++){if(t[u].listener===n.listener){return t[u]}}}return null};var v=function(e){var n=e.prototype.addEventListener;e.prototype.addEventListener=function(e,l,t){var i=s(e,l,t);var a=f(this,i);if(!a){var c={};c.type=i.options.polyfill?u(i.type,this):i.type;c.listener=function(n){if(i.options.once&&!r.once){this.removeEventListener(e,l,t)}if(i.options.passive&&!r.passive){n.preventDefault=function(){throw new Error("Unable to preventDefault inside passive event listener invocation.")}}if(i.options.polyfill){n.type=i.type;if(n instanceof KeyboardEvent){if(!("code"in n)){n.code=o[n.keyCode]}}}return i.listener.call(this,n)};c.options=r.some?i.options:i.options.capture;i.vendorArguments=c;p(this,i);n.call(this,c.type,c.listener,c.options)}};var l=e.prototype.removeEventListener;e.prototype.removeEventListener=function(e,n,t){var u=s(e,n,t);var r=f(this,u);if(r){c(this,u);l.call(this,r.vendorArguments.type,r.vendorArguments.listener,r.vendorArguments.options)}else{l.call(this,e,n,t)}}};v(EventTarget);if(!(window instanceof EventTarget)){v(Window)}})();
(function(){if(typeof EventTarget==="undefined"){window.EventTarget=Node}var e=function(e,n){return"on"+n in e};var n=function(n,l){return e(n,l)||n.style["transition"]!==void 0};var l=["","webkit","moz","ms","o"];var t={wheel:["wheel","mousewheel","DOMMouseScroll"].map(function(n){return{type:n,test:e}})};["pointerlockchange","pointerlockerror","fullscreenchange","fullscreenerror","animationstart","animationiteration","animationend","pointercancel","pointerdown","pointerhover","pointermove","pointerout","pointerover","pointerup"].forEach(function(n){t[n]=l.map(function(l){return{type:l+n,test:e}})});["transitionstart","transitionrun","transitionend"].forEach(function(e){t[e]=l.map(function(l){return{type:l+e,test:n}})});var u=function(e,n){var l=t[e];if(l===void 0){return e}else{var u=0;for(;u<l.length;u++){if(l[u].test(n,e)){return l[u].type}}if(u===l.length){throw new Error("Not supported type <"+e+">")}}};var r={once:false,passive:false,capture:false};document.createDocumentFragment().addEventListener("test",function(){},{get once(){r.once=true;return false},get passive(){r.passive=true;return false},get capture(){r.capture=true;return false}});r.all=r.once&&r.passive&&r.capture;r.some=r.once||r.passive||r.capture;var o=[null,null,null,null,null,null,null,null,"Backspace","Tab",null,null,"Numpad5","NumpadEnter",null,null,"ShiftLeft","ControlRight","AltRight","Pause","CapsLock",null,null,null,null,null,null,"Escape",null,null,null,null,"Space","PageUp","PageDown","End","Home","ArrowLeft","ArrowUp","ArrowRight","ArrowDown",null,null,null,null,"Insert","Delete",null,"Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9",null,null,null,null,null,null,null,"KeyA","KeyB","KeyC","KeyD","KeyE","KeyF","KeyG","KeyH","KeyI","KeyJ","KeyK","KeyL","KeyM","KeyN","KeyO","KeyP","KeyQ","KeyR","KeyS","KeyT","KeyU","KeyV","KeyW","KeyX","KeyZ","KeyY","MetaLeft","MetaRight","ContextMenu",null,null,"Numpad0","Numpad1","Numpad2","Numpad3","Numpad4","Numpad5","Numpad6","Numpad7","Numpad8","Numpad9","NumpadMultiply","NumpadAdd",null,"NumpadSubtract","NumpadDecimal","NumpadDivide","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"NumLock","ScrollLock",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"BracketLeft",null,"Comma","Slash","Period","Backquote","BracketRight",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"Minus","Quote","Equal","Semicolon","Backslash",null,null,"IntlBackslash"];var i=function(e){if(typeof e==="function"){return e}else if(typeof e==="object"&&typeof e.handleEvent==="function"){return e.handleEvent}else{return function(n){e(n)}}};var a=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");break}e.once=typeof e.once==="boolean"?e.once:false;e.passive=typeof e.passive==="boolean"?e.passive:false;e.capture=typeof e.capture==="boolean"?e.capture:false;e.polyfill=typeof e.polyfill==="boolean"?e.polyfill:true;return e};var s=function(e,n,l){return{type:e,listener:i(n),options:a(l)}};var p=function(e,n){var l=n.type+"-"+(n.options.capture?"1":"0");if(e.__eventListeners===void 0){e.__eventListeners={}}if(e.__eventListeners[l]===void 0){e.__eventListeners[l]=[]}e.__eventListeners[l].push(n)};var c=function(e,n){var l=n.type+"-"+(n.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[l]!==void 0){var t=e.__eventListeners[l];for(var u=0;u<t.length;u++){if(t[u].listener===n.listener){t.splice(u,1)}}if(t.length===0){delete e.__eventListeners[l]}}};var f=function(e,n){var l=n.type+"-"+(n.options.capture?"1":"0");if(e.__eventListeners!==void 0&&e.__eventListeners[l]!==void 0){var t=e.__eventListeners[l];for(var u=0;u<t.length;u++){if(t[u].listener===n.listener){return t[u]}}}return null};var v=function(e){var n=e.prototype.addEventListener;e.prototype.addEventListener=function(e,l,t){var i=s(e,l,t);var a=f(this,i);if(!a){var c={};c.type=i.options.polyfill?u(i.type,this):i.type;c.listener=function(n){if(i.options.once&&!r.once){this.removeEventListener(e,l,t)}if(i.options.passive&&!r.passive){n.preventDefault=function(){throw new Error("Unable to preventDefault inside passive event listener invocation.")}}if(i.options.polyfill){n.type=i.type;if(n instanceof KeyboardEvent){if(!("code"in n)){n.code=o[n.keyCode]}}}return i.listener.call(this,n)};c.options=r.some?i.options:i.options.capture;i.vendorArguments=c;p(this,i);n.call(this,c.type,c.listener,c.options)}};var l=e.prototype.removeEventListener;e.prototype.removeEventListener=function(e,n,t){var u=s(e,n,t);var r=f(this,u);if(r){c(this,u);l.call(this,r.vendorArguments.type,r.vendorArguments.listener,r.vendorArguments.options)}else{l.call(this,e,n,t)}}};v(EventTarget);if(!(window instanceof EventTarget)){v(Window)}})();
{
"name": "events-polyfill",
"version": "1.1.6",
"version": "1.1.7",
"description": "Polyfill event : EventListener, EventTarget, CustomEvent, MouseEvent, KeyboardEvent",

@@ -5,0 +5,0 @@ "main": "event-constructor-polyfill.js",

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