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

@analytics/listener-utils

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@analytics/listener-utils - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

dist/index.html

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [0.4.0](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener/compare/@analytics/listener-utils@0.3.2...@analytics/listener-utils@0.4.0) (2023-12-31)
### Features
* add support for comma separated values & dom arrays ([ab39bb5](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener/commit/ab39bb5c89a217f6a777413d26d8004880cd6d76))
## [0.3.2](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener/compare/@analytics/listener-utils@0.3.1...@analytics/listener-utils@0.3.2) (2023-05-27)

@@ -8,0 +19,0 @@

2

dist/analytics-util-listener.js

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

var n=require("@analytics/type-utils");function r(r){return function(o,i,u,l){var s=u||n.noOp;if(!n.isBrowser)return s;var a=l||!1,v=e(i),d=e(o,!0),f=[];if(!d.length)throw new Error("noElements");if(!v.length)throw new Error("noEvent");return function n(r){var e=r?"addEventListener":"removeEventListener";r&&(f=[]);for(var o=0;o<d.length;o++){var i=d[o];f[o]=r?t(s,a):f[o]||s;for(var u=0;u<v.length;u++)i[e]?i[e](v[u],f[o],a):i["on"+v[u]]=r?f[o]:null}return n.bind(null,!r)}(r)}}function e(r,t){if(n.isString(r))return t?e(document.querySelectorAll(r)):r.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(r)){for(var o=[],i=r.length>>>0;i--;)o[i]=r[i];return o}return n.ensureArray(r)}function t(n,r){return r&&r.once?o(n):n}function o(n,r){var e;return function(){return n&&(e=n.apply(r||this,arguments),n=null),e}}var i=r("Event"),u=r();function l(r,e){return n.isBrowser&&n.isFunction(window[r])?(t=window[r],o=e,void 0===(i=window)&&(i=null),n.isFunction(t)?function(){t.apply(i,arguments),o.apply(i,arguments)}:o):window[r]=e;var t,o,i}var s=l.bind(null,"onerror"),a=l.bind(null,"onload");exports.addListener=i,exports.addWindowEvent=l,exports.onError=s,exports.onLoad=a,exports.once=o,exports.removeListener=u;
var r=require("@analytics/type-utils"),n="EventListener";function t(t){return function(i,u,l,a){var s=l||r.noOp,f=a||!1;if(!r.isBrowser)return s;var v=e(u),d=e(i,!0);if(!d.length)throw new Error("noElements");if(!v.length)throw new Error("noEvent");var p=[];return function r(t){t&&(p=[]);for(var e=t?"add"+n:"remove"+n,i=0;i<d.length;i++){var u=d[i];p[i]=t?f&&f.once?o(s):s:p[i]||s;for(var l=0;l<v.length;l++)u[e]?u["on"+v[l]]=t?p[i]:null:u[e](v[l],p[i],f)}return r.bind(null,!t)}(t)}}function e(n,t){if(r.isString(n))return t?e(document.querySelectorAll(n)):(o=n).split(o.indexOf(",")>-1?",":" ").map(function(r){return r.trim()});var o;if(NodeList.prototype.isPrototypeOf(n)){for(var i=[],u=n.length>>>0;u--;)i[u]=n[u];return i}var l=r.ensureArray(n);return t?l.map(function(n){return r.isString(n)?e(n,!0):n}).flat():l}function o(r,n){var t;return function(){return r&&(t=r.apply(n||this,arguments),r=null),t}}var i=t("Event"),u=t();function l(n,t){return r.isBrowser&&r.isFunction(window[n])?(e=window[n],o=t,void 0===(i=window)&&(i=null),r.isFunction(e)?function(){e.apply(i,arguments),o.apply(i,arguments)}:o):window[n]=t;var e,o,i}var a=l.bind(null,"onerror"),s=l.bind(null,"onload");exports.addListener=i,exports.addWindowEvent=l,exports.onError=a,exports.onLoad=s,exports.once=o,exports.removeListener=u;
//# sourceMappingURL=analytics-util-listener.js.map

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

import{isBrowser as n,isFunction as t,noOp as r,isString as o,ensureArray as e}from"@analytics/type-utils";function i(t){return(o,e,i,c)=>{const f=i||r;if(!n)return f;const s=c||!1,p=l(e),d=l(o,!0);let w=[];if(!d.length)throw new Error("noElements");if(!p.length)throw new Error("noEvent");return function n(t){const r=t?"addEventListener":"removeEventListener";t&&(w=[]);for(let n=0;n<d.length;n++){const o=d[n];w[n]=t?u(f,s):w[n]||f;for(let e=0;e<p.length;e++)o[r]?o[r](p[e],w[n],s):o["on"+p[e]]=t?w[n]:null}return n.bind(null,!t)}(t)}}function l(n,t){if(o(n))return t?l(document.querySelectorAll(n)):n.split(" ").map(n=>n.trim());if(NodeList.prototype.isPrototypeOf(n)){const t=[];for(var r=n.length>>>0;r--;)t[r]=n[r];return t}return e(n)}function u(n,t){return t&&t.once?c(n):n}function c(n,t){var r;return function(){return n&&(r=n.apply(t||this,arguments),n=null),r}}const f=i("Event"),s=i();function p(r,o){return n&&t(window[r])?function(n,r,o=null){return t(n)?function(){n.apply(o,arguments),r.apply(o,arguments)}:r}(window[r],o,window):window[r]=o}const d=p.bind(null,"onerror"),w=p.bind(null,"onload");export{f as addListener,p as addWindowEvent,d as onError,w as onLoad,c as once,s as removeListener};
import{isBrowser as n,isFunction as t,noOp as r,isString as o,ensureArray as e}from"@analytics/type-utils";const l="EventListener";function i(t){return(o,e,i,f)=>{const s=i||r,p=f||!1;if(!n)return s;const a=u(e),d=u(o,!0);if(!d.length)throw new Error("noElements");if(!a.length)throw new Error("noEvent");let w=[];return function n(t){t&&(w=[]);const r=t?"add"+l:"remove"+l;for(let n=0;n<d.length;n++){const o=d[n];w[n]=t?p&&p.once?c(s):s:w[n]||s;for(let e=0;e<a.length;e++)o[r]?o["on"+a[e]]=t?w[n]:null:o[r](a[e],w[n],p)}return n.bind(null,!t)}(t)}}function u(n,t){if(o(n))return t?u(document.querySelectorAll(n)):(r=n).split(r.indexOf(",")>-1?",":" ").map(n=>n.trim());var r;if(NodeList.prototype.isPrototypeOf(n)){const t=[];for(var l=n.length>>>0;l--;)t[l]=n[l];return t}const i=e(n);return t?i.map(n=>o(n)?u(n,!0):n).flat():i}function c(n,t){var r;return function(){return n&&(r=n.apply(t||this,arguments),n=null),r}}const f=i("Event"),s=i();function p(r,o){return n&&t(window[r])?function(n,r,o=null){return t(n)?function(){n.apply(o,arguments),r.apply(o,arguments)}:r}(window[r],o,window):window[r]=o}const a=p.bind(null,"onerror"),d=p.bind(null,"onload");export{f as addListener,p as addWindowEvent,a as onError,d as onLoad,c as once,s as removeListener};
//# sourceMappingURL=analytics-util-listener.modern.js.map

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

import{isBrowser as n,isFunction as r,noOp as t,isString as e,ensureArray as o}from"@analytics/type-utils";function i(r){return function(e,o,i,f){var a=i||t;if(!n)return a;var v=f||!1,c=u(o),p=u(e,!0),d=[];if(!p.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");return function n(r){var t=r?"addEventListener":"removeEventListener";r&&(d=[]);for(var e=0;e<p.length;e++){var o=p[e];d[e]=r?l(a,v):d[e]||a;for(var i=0;i<c.length;i++)o[t]?o[t](c[i],d[e],v):o["on"+c[i]]=r?d[e]:null}return n.bind(null,!r)}(r)}}function u(n,r){if(e(n))return r?u(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var t=[],i=n.length>>>0;i--;)t[i]=n[i];return t}return o(n)}function l(n,r){return r&&r.once?f(n):n}function f(n,r){var t;return function(){return n&&(t=n.apply(r||this,arguments),n=null),t}}var a=i("Event"),v=i();function c(t,e){return n&&r(window[t])?(o=window[t],i=e,void 0===(u=window)&&(u=null),r(o)?function(){o.apply(u,arguments),i.apply(u,arguments)}:i):window[t]=e;var o,i,u}var p=c.bind(null,"onerror"),d=c.bind(null,"onload");export{a as addListener,c as addWindowEvent,p as onError,d as onLoad,f as once,v as removeListener};
import{isBrowser as n,isFunction as r,noOp as t,isString as o,ensureArray as e}from"@analytics/type-utils";var i="EventListener";function u(r){return function(o,e,u,f){var v=u||t,p=f||!1;if(!n)return v;var c=l(e),d=l(o,!0);if(!d.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");var w=[];return function n(r){r&&(w=[]);for(var t=r?"add"+i:"remove"+i,o=0;o<d.length;o++){var e=d[o];w[o]=r?p&&p.once?a(v):v:w[o]||v;for(var u=0;u<c.length;u++)e[t]?e["on"+c[u]]=r?w[o]:null:e[t](c[u],w[o],p)}return n.bind(null,!r)}(r)}}function l(n,r){if(o(n))return r?l(document.querySelectorAll(n)):(t=n).split(t.indexOf(",")>-1?",":" ").map(function(n){return n.trim()});var t;if(NodeList.prototype.isPrototypeOf(n)){for(var i=[],u=n.length>>>0;u--;)i[u]=n[u];return i}var a=e(n);return r?a.map(function(n){return o(n)?l(n,!0):n}).flat():a}function a(n,r){var t;return function(){return n&&(t=n.apply(r||this,arguments),n=null),t}}var f=u("Event"),v=u();function p(t,o){return n&&r(window[t])?(e=window[t],i=o,void 0===(u=window)&&(u=null),r(e)?function(){e.apply(u,arguments),i.apply(u,arguments)}:i):window[t]=o;var e,i,u}var c=p.bind(null,"onerror"),d=p.bind(null,"onload");export{f as addListener,p as addWindowEvent,c as onError,d as onLoad,a as once,v as removeListener};
//# sourceMappingURL=analytics-util-listener.module.js.map

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@analytics/type-utils")):"function"==typeof define&&define.amd?define(["exports","@analytics/type-utils"],e):e((n||self).utilListener={},n.typeUtils)}(this,function(n,e){function r(n){return function(r,i,u,l){var f=u||e.noOp;if(!e.isBrowser)return f;var s=l||!1,a=t(i),d=t(r,!0),c=[];if(!d.length)throw new Error("noElements");if(!a.length)throw new Error("noEvent");return function n(e){var r=e?"addEventListener":"removeEventListener";e&&(c=[]);for(var t=0;t<d.length;t++){var i=d[t];c[t]=e?o(f,s):c[t]||f;for(var u=0;u<a.length;u++)i[r]?i[r](a[u],c[t],s):i["on"+a[u]]=e?c[t]:null}return n.bind(null,!e)}(n)}}function t(n,r){if(e.isString(n))return r?t(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var o=[],i=n.length>>>0;i--;)o[i]=n[i];return o}return e.ensureArray(n)}function o(n,e){return e&&e.once?i(n):n}function i(n,e){var r;return function(){return n&&(r=n.apply(e||this,arguments),n=null),r}}var u=r("Event"),l=r();function f(n,r){return e.isBrowser&&e.isFunction(window[n])?(t=window[n],o=r,void 0===(i=window)&&(i=null),e.isFunction(t)?function(){t.apply(i,arguments),o.apply(i,arguments)}:o):window[n]=r;var t,o,i}var s=f.bind(null,"onerror"),a=f.bind(null,"onload");n.addListener=u,n.addWindowEvent=f,n.onError=s,n.onLoad=a,n.once=i,n.removeListener=l});
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@analytics/type-utils")):"function"==typeof define&&define.amd?define(["exports","@analytics/type-utils"],r):r((n||self).utilListener={},n.typeUtils)}(this,function(n,r){var e="EventListener";function t(n){return function(t,u,l,f){var a=l||r.noOp,s=f||!1;if(!r.isBrowser)return a;var d=o(u),p=o(t,!0);if(!p.length)throw new Error("noElements");if(!d.length)throw new Error("noEvent");var c=[];return function n(r){r&&(c=[]);for(var t=r?"add"+e:"remove"+e,o=0;o<p.length;o++){var u=p[o];c[o]=r?s&&s.once?i(a):a:c[o]||a;for(var l=0;l<d.length;l++)u[t]?u["on"+d[l]]=r?c[o]:null:u[t](d[l],c[o],s)}return n.bind(null,!r)}(n)}}function o(n,e){if(r.isString(n))return e?o(document.querySelectorAll(n)):(t=n).split(t.indexOf(",")>-1?",":" ").map(function(n){return n.trim()});var t;if(NodeList.prototype.isPrototypeOf(n)){for(var i=[],u=n.length>>>0;u--;)i[u]=n[u];return i}var l=r.ensureArray(n);return e?l.map(function(n){return r.isString(n)?o(n,!0):n}).flat():l}function i(n,r){var e;return function(){return n&&(e=n.apply(r||this,arguments),n=null),e}}var u=t("Event"),l=t();function f(n,e){return r.isBrowser&&r.isFunction(window[n])?(t=window[n],o=e,void 0===(i=window)&&(i=null),r.isFunction(t)?function(){t.apply(i,arguments),o.apply(i,arguments)}:o):window[n]=e;var t,o,i}var a=f.bind(null,"onerror"),s=f.bind(null,"onload");n.addListener=u,n.addWindowEvent=f,n.onError=a,n.onLoad=s,n.once=i,n.removeListener=l});
//# sourceMappingURL=analytics-util-listener.umd.js.map

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

var utilListener=function(n){var r=function(){};"undefined"==typeof process||process;var t="undefined"!=typeof document;function e(n,r){return r.charAt(0)[n]()+r.slice(1)}"undefined"!=typeof Deno&&Deno,t&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var o=e.bind(null,"toUpperCase"),u=e.bind(null,"toLowerCase");function i(n,r){void 0===r&&(r=!0);var t=function(n){return f(n)?o("null"):"object"==typeof n?function(n){return c(n.constructor)?n.constructor.name:null}(n):Object.prototype.toString.call(n).slice(8,-1)}(n);return r?u(t):t}function l(n,r){return typeof r===n}var c=l.bind(null,"function"),a=l.bind(null,"string");function f(n){return null===n}function d(n,r){if("object"!=typeof r||f(r))return!1;if(r instanceof n)return!0;var t=i(new n(""));if(function(n){return n instanceof Error||a(n.message)&&n.constructor&&function(n){return"number"===i(n)&&!isNaN(n)}(n.constructor.stackTraceLimit)}(r))for(;r;){if(i(r)===t)return!0;r=Object.getPrototypeOf(r)}return!1}function s(n,r){var t=n instanceof Element||n instanceof HTMLDocument;return t&&r?function(n,r){return void 0===r&&(r=""),n&&n.nodeName===r.toUpperCase()}(n,r):t}function v(n){var r=[].slice.call(arguments,1);return function(){return n.apply(void 0,[].slice.call(arguments).concat(r))}}function p(n){return function(e,o,u,i){var l=u||r;if(!t)return l;var c=i||!1,a=b(o),f=b(e,!0),d=[];if(!f.length)throw new Error("noElements");if(!a.length)throw new Error("noEvent");return function n(r){var t=r?"addEventListener":"removeEventListener";r&&(d=[]);for(var e=0;e<f.length;e++){var o=f[e];d[e]=r?y(l,c):d[e]||l;for(var u=0;u<a.length;u++)o[t]?o[t](a[u],d[e],c):o["on"+a[u]]=r?d[e]:null}return n.bind(null,!r)}(n)}}function b(n,r){if(a(n))return r?b(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var t=[],e=n.length>>>0;e--;)t[e]=n[e];return t}return(o=n)?function(n){return"array"===i(n)}(o)?o:[o]:[];var o}function y(n,r){return r&&r.once?m(n):n}function m(n,r){var t;return function(){return n&&(t=n.apply(r||this,arguments),n=null),t}}l.bind(null,"undefined"),l.bind(null,"boolean"),l.bind(null,"symbol"),d.bind(null,TypeError),d.bind(null,SyntaxError),v(s,"form"),v(s,"button"),v(s,"input"),v(s,"select");var w=p("Event"),g=p();function E(n,r){return t&&c(window[n])?(e=window[n],o=r,void 0===(u=window)&&(u=null),c(e)?function(){e.apply(u,arguments),o.apply(u,arguments)}:o):window[n]=r;var e,o,u}var L=E.bind(null,"onerror"),h=E.bind(null,"onload");return n.addListener=w,n.addWindowEvent=E,n.onError=L,n.onLoad=h,n.once=m,n.removeListener=g,n}({});
var utilListener=function(n){var r=function(){};"undefined"==typeof process||process;var t="undefined"!=typeof document;function e(n,r){return r.charAt(0)[n]()+r.slice(1)}"undefined"!=typeof Deno&&Deno,t&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var o=e.bind(null,"toUpperCase"),u=e.bind(null,"toLowerCase");function i(n,r){void 0===r&&(r=!0);var t=function(n){return f(n)?o("null"):"object"==typeof n?function(n){return a(n.constructor)?n.constructor.name:null}(n):Object.prototype.toString.call(n).slice(8,-1)}(n);return r?u(t):t}function l(n,r){return typeof r===n}var a=l.bind(null,"function"),c=l.bind(null,"string");function f(n){return null===n}function d(n,r){if("object"!=typeof r||f(r))return!1;if(r instanceof n)return!0;var t=i(new n(""));if(function(n){return n instanceof Error||c(n.message)&&n.constructor&&function(n){return"number"===i(n)&&!isNaN(n)}(n.constructor.stackTraceLimit)}(r))for(;r;){if(i(r)===t)return!0;r=Object.getPrototypeOf(r)}return!1}function s(n,r){var t=n instanceof Element||n instanceof HTMLDocument;return t&&r?function(n,r){return void 0===r&&(r=""),n&&n.nodeName===r.toUpperCase()}(n,r):t}function v(n){var r=[].slice.call(arguments,1);return function(){return n.apply(void 0,[].slice.call(arguments).concat(r))}}l.bind(null,"undefined"),l.bind(null,"boolean"),l.bind(null,"symbol"),d.bind(null,TypeError),d.bind(null,SyntaxError),v(s,"form"),v(s,"button"),v(s,"input"),v(s,"select");var p="EventListener";function b(n){return function(e,o,u,i){var l=u||r,a=i||!1;if(!t)return l;var c=y(o),f=y(e,!0);if(!f.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");var d=[];return function n(r){r&&(d=[]);for(var t=r?"add"+p:"remove"+p,e=0;e<f.length;e++){var o=f[e];d[e]=r?a&&a.once?m(l):l:d[e]||l;for(var u=0;u<c.length;u++)o[t]?o["on"+c[u]]=r?d[e]:null:o[t](c[u],d[e],a)}return n.bind(null,!r)}(n)}}function y(n,r){if(c(n))return r?y(document.querySelectorAll(n)):(t=n).split(t.indexOf(",")>-1?",":" ").map(function(n){return n.trim()});var t;if(NodeList.prototype.isPrototypeOf(n)){for(var e=[],o=n.length>>>0;o--;)e[o]=n[o];return e}var u,l=(u=n)?function(n){return"array"===i(n)}(u)?u:[u]:[];return r?l.map(function(n){return c(n)?y(n,!0):n}).flat():l}function m(n,r){var t;return function(){return n&&(t=n.apply(r||this,arguments),n=null),t}}var w=b("Event"),g=b();function E(n,r){return t&&a(window[n])?(e=window[n],o=r,void 0===(u=window)&&(u=null),a(e)?function(){e.apply(u,arguments),o.apply(u,arguments)}:o):window[n]=r;var e,o,u}var h=E.bind(null,"onerror"),L=E.bind(null,"onload");return n.addListener=w,n.addWindowEvent=E,n.onError=h,n.onLoad=L,n.once=m,n.removeListener=g,n}({});
//# sourceMappingURL=listener-utils.js.map

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n||self).utilListener={})}(this,function(n){var e=function(){};"undefined"==typeof process||process;var r="undefined"!=typeof document;function t(n,e){return e.charAt(0)[n]()+e.slice(1)}"undefined"!=typeof Deno&&Deno,r&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var o=t.bind(null,"toUpperCase"),i=t.bind(null,"toLowerCase");function u(n,e){void 0===e&&(e=!0);var r=function(n){return a(n)?o("null"):"object"==typeof n?function(n){return f(n.constructor)?n.constructor.name:null}(n):Object.prototype.toString.call(n).slice(8,-1)}(n);return e?i(r):r}function l(n,e){return typeof e===n}var f=l.bind(null,"function"),c=l.bind(null,"string");function a(n){return null===n}function d(n,e){if("object"!=typeof e||a(e))return!1;if(e instanceof n)return!0;var r=u(new n(""));if(function(n){return n instanceof Error||c(n.message)&&n.constructor&&function(n){return"number"===u(n)&&!isNaN(n)}(n.constructor.stackTraceLimit)}(e))for(;e;){if(u(e)===r)return!0;e=Object.getPrototypeOf(e)}return!1}function s(n,e){var r=n instanceof Element||n instanceof HTMLDocument;return r&&e?function(n,e){return void 0===e&&(e=""),n&&n.nodeName===e.toUpperCase()}(n,e):r}function p(n){var e=[].slice.call(arguments,1);return function(){return n.apply(void 0,[].slice.call(arguments).concat(e))}}function v(n){return function(t,o,i,u){var l=i||e;if(!r)return l;var f=u||!1,c=y(o),a=y(t,!0),d=[];if(!a.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");return function n(e){var r=e?"addEventListener":"removeEventListener";e&&(d=[]);for(var t=0;t<a.length;t++){var o=a[t];d[t]=e?b(l,f):d[t]||l;for(var i=0;i<c.length;i++)o[r]?o[r](c[i],d[t],f):o["on"+c[i]]=e?d[t]:null}return n.bind(null,!e)}(n)}}function y(n,e){if(c(n))return e?y(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var r=[],t=n.length>>>0;t--;)r[t]=n[t];return r}return(o=n)?function(n){return"array"===u(n)}(o)?o:[o]:[];var o}function b(n,e){return e&&e.once?m(n):n}function m(n,e){var r;return function(){return n&&(r=n.apply(e||this,arguments),n=null),r}}l.bind(null,"undefined"),l.bind(null,"boolean"),l.bind(null,"symbol"),d.bind(null,TypeError),d.bind(null,SyntaxError),p(s,"form"),p(s,"button"),p(s,"input"),p(s,"select");var g=v("Event"),w=v();function E(n,e){return r&&f(window[n])?(t=window[n],o=e,void 0===(i=window)&&(i=null),f(t)?function(){t.apply(i,arguments),o.apply(i,arguments)}:o):window[n]=e;var t,o,i}var h=E.bind(null,"onerror"),L=E.bind(null,"onload");n.addListener=g,n.addWindowEvent=E,n.onError=h,n.onLoad=L,n.once=m,n.removeListener=w});
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n||self).utilListener={})}(this,function(n){var e=function(){};"undefined"==typeof process||process;var r="undefined"!=typeof document;function t(n,e){return e.charAt(0)[n]()+e.slice(1)}"undefined"!=typeof Deno&&Deno,r&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var o=t.bind(null,"toUpperCase"),i=t.bind(null,"toLowerCase");function u(n,e){void 0===e&&(e=!0);var r=function(n){return a(n)?o("null"):"object"==typeof n?function(n){return f(n.constructor)?n.constructor.name:null}(n):Object.prototype.toString.call(n).slice(8,-1)}(n);return e?i(r):r}function l(n,e){return typeof e===n}var f=l.bind(null,"function"),c=l.bind(null,"string");function a(n){return null===n}function d(n,e){if("object"!=typeof e||a(e))return!1;if(e instanceof n)return!0;var r=u(new n(""));if(function(n){return n instanceof Error||c(n.message)&&n.constructor&&function(n){return"number"===u(n)&&!isNaN(n)}(n.constructor.stackTraceLimit)}(e))for(;e;){if(u(e)===r)return!0;e=Object.getPrototypeOf(e)}return!1}function s(n,e){var r=n instanceof Element||n instanceof HTMLDocument;return r&&e?function(n,e){return void 0===e&&(e=""),n&&n.nodeName===e.toUpperCase()}(n,e):r}function p(n){var e=[].slice.call(arguments,1);return function(){return n.apply(void 0,[].slice.call(arguments).concat(e))}}l.bind(null,"undefined"),l.bind(null,"boolean"),l.bind(null,"symbol"),d.bind(null,TypeError),d.bind(null,SyntaxError),p(s,"form"),p(s,"button"),p(s,"input"),p(s,"select");var v="EventListener";function y(n){return function(t,o,i,u){var l=i||e,f=u||!1;if(!r)return l;var c=b(o),a=b(t,!0);if(!a.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");var d=[];return function n(e){e&&(d=[]);for(var r=e?"add"+v:"remove"+v,t=0;t<a.length;t++){var o=a[t];d[t]=e?f&&f.once?m(l):l:d[t]||l;for(var i=0;i<c.length;i++)o[r]?o["on"+c[i]]=e?d[t]:null:o[r](c[i],d[t],f)}return n.bind(null,!e)}(n)}}function b(n,e){if(c(n))return e?b(document.querySelectorAll(n)):(r=n).split(r.indexOf(",")>-1?",":" ").map(function(n){return n.trim()});var r;if(NodeList.prototype.isPrototypeOf(n)){for(var t=[],o=n.length>>>0;o--;)t[o]=n[o];return t}var i,l=(i=n)?function(n){return"array"===u(n)}(i)?i:[i]:[];return e?l.map(function(n){return c(n)?b(n,!0):n}).flat():l}function m(n,e){var r;return function(){return n&&(r=n.apply(e||this,arguments),n=null),r}}var g=y("Event"),w=y();function h(n,e){return r&&f(window[n])?(t=window[n],o=e,void 0===(i=window)&&(i=null),f(t)?function(){t.apply(i,arguments),o.apply(i,arguments)}:o):window[n]=e;var t,o,i}var E=h.bind(null,"onerror"),L=h.bind(null,"onload");n.addListener=g,n.addWindowEvent=h,n.onError=E,n.onLoad=L,n.once=m,n.removeListener=w});
//# sourceMappingURL=listener-utils.umd.js.map
{
"name": "@analytics/listener-utils",
"version": "0.3.2",
"version": "0.4.0",
"description": "Backward compatible event listener library for attaching & detaching event handlers",

@@ -16,3 +16,2 @@ "author": "David Wells",

],
"netlifySiteId": "804da5e7-8aa8-4da8-a983-8593754cacb9",
"amdName": "utilListener",

@@ -34,3 +33,3 @@ "source": "src/index.js",

"watch:test": "watchlist src tests examples -- npm t",
"build": "microbundle && npm run build:dev",
"build": "npm run sync && microbundle && npm run build:dev",
"build:dev": "microbundle build --external none -f iife,umd -o dist/browser",

@@ -40,3 +39,3 @@ "release:patch": "npm version patch && npm publish",

"release:major": "npm version major && npm publish",
"deploy": "npm run build:dev && npm run sync && netlify deploy --prod --dir dist --site $npm_package_netlifySiteId"
"deploy": "npm run build:dev && npm run sync && netlify deploy --prod --dir dist --site 804da5e7-8aa8-4da8-a983-8593754cacb9"
},

@@ -62,3 +61,3 @@ "files": [

},
"gitHead": "904e8bc88a9de0d9e55ecbe1e87ac2ee2a454e32"
"gitHead": "95db3ea7282785e9e4fc736e1416dd441b0bbf36"
}

@@ -5,12 +5,12 @@ /**

* @param {*} [context] - Extend function context
* @returns
* @returns {Function} Function that only runs 1 time
*/
export function once(fn: Function, context?: any): (...args: any[]) => any;
export function once(fn: Function, context?: any): Function;
export function addWindowEvent(event: any, fn: any): any;
/**
* Element selector
* Element selector or valid DOM node
* @typedef {(string|Node|NodeList|EventTarget|null)} Selector
*/
/**
* Event to listen to
* Event or events to addEventListener to
* @typedef {(string|string[])} EventType

@@ -24,3 +24,3 @@ */

/**
* ReAttach event listener
* Reattach event listener
* @callback AttachListener

@@ -31,3 +31,3 @@ * @returns {RemoveListener}

* Add an event listener
* @callback AddEventListener
* @callback AddListener
* @param {Selector} elements - Element(s) to attach event(s) to.

@@ -40,7 +40,7 @@ * @param {EventType} eventType - Event(s) to listen to

*/
/** @type {AddEventListener} */
export const addListener: AddEventListener;
/** @type {AddListener} */
export const addListener: AddListener;
/**
* Remove an event listener
* @callback RemoveEventListener
* @callback RemoveListener
* @param {Selector} elements - Element(s) to remove event(s) from.

@@ -53,12 +53,12 @@ * @param {EventType} eventType - Event(s) to remove

*/
/** @type {RemoveEventListener} */
export const removeListener: RemoveEventListener;
/** @type {RemoveListener} */
export const removeListener: RemoveListener;
export const onError: (fn?: any) => any;
export const onLoad: (fn?: any) => any;
/**
* Element selector
* Element selector or valid DOM node
*/
export type Selector = (string | Node | NodeList | EventTarget | null);
/**
* Event to listen to
* Event or events to addEventListener to
*/

@@ -71,3 +71,3 @@ export type EventType = (string | string[]);

/**
* ReAttach event listener
* Reattach event listener
*/

@@ -78,6 +78,2 @@ export type AttachListener = () => RemoveListener;

*/
export type AddEventListener = (elements: Selector, eventType: EventType, handler?: Function | undefined, options?: Object | undefined, once?: boolean | undefined) => RemoveListener;
/**
* Remove an event listener
*/
export type RemoveEventListener = (elements: Selector, eventType: EventType, handler?: Function | undefined, options?: Object | undefined, once?: boolean | undefined) => AttachListener;
export type AddListener = (elements: Selector, eventType: EventType, handler?: Function | undefined, options?: Object | undefined, once?: boolean | undefined) => RemoveListener;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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