passive-events-support
Advanced tools
Comparing version 1.0.16 to 1.0.17
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";function e(e=!1){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(e){}if(e){const e=`[Passive Events Support] "passive" option is ${t?"":"not "}supported by your browser.`;t?console.info(e):console.warn(e)}return t}window.passiveSupported=e(),function(t=null,n=!1){const s=t||["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"],o=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(...t){const i=t[2];if(s.includes(t[0])&&(!t[2]||void 0===t[2].passive)){const s=t[1].toString(),[o,...u]=s.split("{"),r=o.replace(/(function|=>)/,"").trim(),c=u.join("{"),l=(r.match(/\(([^)]+)\)/)||[`(${r})`])[0].replace(/[()]/g,""),d=!(!l||!(c.includes("preventDefault")||c.includes(`(${l})`)||c.includes(`(${l},`)||c.includes(`,${l})`)||c.includes(`, ${l})`)||c.includes(`,${l},`)||c.includes(`, ${l},`)));t[2]={...t[2]||{},...e()&&{passive:!d}},n&&console.info("[Passive Events Support] Updated Event Listeners",{element:this,event:t[0],handler:{fnArgument:l,fnContent:c,fnPrevented:d},oldArguments:i,updatedArguments:t[2]})}o.call(this,...t)}}(window.passiveEvents)})(); | ||
(()=>{"use strict";function e(e=!1){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(e){}if(e){const e=`[Passive Events Support] "passive" option is ${t?"":"not "}supported by your browser.`;t?console.info(e):console.warn(e)}return t}window.passiveSupported=e(),function(t=null,n=!1){const s=t||["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"],o=EventTarget.prototype.addEventListener;EventTarget.prototype.addEventListener=function(...t){const i=t[2];if(s.includes(t[0])&&(!t[2]||void 0===t[2].passive)){const s=t[1].toString(),[o,...u]=s.split("{"),r=o.replace(/(function|=>)/,"").trim(),c=u.join("{"),l=(r.match(/\(([^)]+)\)/)||[`(${r})`])[0].replace(/[()]/g,""),d=!(!l||!(c.includes("preventDefault")||c.includes(`(${l})`)||c.includes(`(${l},`)||c.includes(`,${l})`)||c.includes(`, ${l})`)||c.includes(`,${l},`)||c.includes(`, ${l},`)));t[2]={...t[2]||{},...e()&&{passive:!d}},n&&console.info("[Passive Events Support] Updated Event Listeners",{element:this,event:t[0],handler:{fn:t[1],fnArgument:l,fnContent:c,fnPrevented:d},oldArguments:i,updatedArguments:t[2]})}o.call(this,...t)}}(window.passiveEvents)})(); |
{ | ||
"name": "passive-events-support", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"description": "Passive Events Support", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -74,3 +74,8 @@ export function passiveSupported(debug = false) { | ||
event: args[0], | ||
handler: { fnArgument, fnContent, fnPrevented }, | ||
handler: { | ||
fn: args[1], | ||
fnArgument, | ||
fnContent, | ||
fnPrevented | ||
}, | ||
oldArguments, | ||
@@ -77,0 +82,0 @@ updatedArguments: args[2] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11937
79