@analytics/listener-utils
Advanced tools
Comparing version 0.2.10 to 0.3.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.3.0](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener/compare/@analytics/listener-utils@0.2.10...@analytics/listener-utils@0.3.0) (2022-03-18) | ||
### Features | ||
* add addWindowEvent, onError, onLoad ([5e61ac7](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener/commit/5e61ac7db4307eccee865227ef952da7ae82e584)) | ||
## [0.2.10](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-listener/compare/@analytics/listener-utils@0.2.9...@analytics/listener-utils@0.2.10) (2022-02-05) | ||
@@ -8,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
var r=require("@analytics/type-utils");function n(n){return function(o,i,u,l){var s=u||r.noOp;if(!r.isBrowser)return s;var a=l||!1,f=e(i),v=e(o,!0),c=[];if(!v.length)throw new Error("noElements");if(!f.length)throw new Error("noEvent");return function r(n){var e=n?"addEventListener":"removeEventListener";n&&(c=[]);for(var o=0;o<v.length;o++){var i=v[o];c[o]=n?t(s,a):c[o]||s;for(var u=0;u<f.length;u++)i[e]?i[e](f[u],c[o],a):i["on"+f[u]]=n?c[o]:null}return r.bind(null,!n)}(n)}}function e(n,t){if(r.isString(n))return t?e(document.querySelectorAll(n)):n.split(" ").map(function(r){return r.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var o=[],i=n.length>>>0;i--;)o[i]=n[i];return o}return r.isArray(n)?n:[n]}function t(r,n){return n&&n.once?o(r):r}function o(r,n){var e;return function(){return r&&(e=r.apply(n||this,arguments),r=null),e}}var i=n("Event"),u=n();exports.addListener=i,exports.once=o,exports.removeListener=u; | ||
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; | ||
//# sourceMappingURL=analytics-util-listener.js.map |
@@ -1,2 +0,2 @@ | ||
import{isBrowser as t,noOp as n,isString as r,isArray as e}from"@analytics/type-utils";function o(r){return(e,o,u,c)=>{const f=u||n;if(!t)return f;const s=c||!1,p=i(o),h=i(e,!0);let a=[];if(!h.length)throw new Error("noElements");if(!p.length)throw new Error("noEvent");return function t(n){const r=n?"addEventListener":"removeEventListener";n&&(a=[]);for(let t=0;t<h.length;t++){const e=h[t];a[t]=n?l(f,s):a[t]||f;for(let o=0;o<p.length;o++)e[r]?e[r](p[o],a[t],s):e["on"+p[o]]=n?a[t]:null}return t.bind(null,!n)}(r)}}function i(t,n){if(r(t))return n?i(document.querySelectorAll(t)):t.split(" ").map(t=>t.trim());if(NodeList.prototype.isPrototypeOf(t)){const n=[];for(var o=t.length>>>0;o--;)n[o]=t[o];return n}return e(t)?t:[t]}function l(t,n){return n&&n.once?u(t):t}function u(t,n){var r;return function(){return t&&(r=t.apply(n||this,arguments),t=null),r}}const c=o("Event"),f=o();export{c as addListener,u as once,f as removeListener}; | ||
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}; | ||
//# sourceMappingURL=analytics-util-listener.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import{isBrowser as r,noOp as n,isString as t,isArray as e}from"@analytics/type-utils";function o(t){return function(e,o,l,f){var a=l||n;if(!r)return a;var v=f||!1,c=u(o),p=u(e,!0),s=[];if(!p.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");return function r(n){var t=n?"addEventListener":"removeEventListener";n&&(s=[]);for(var e=0;e<p.length;e++){var o=p[e];s[e]=n?i(a,v):s[e]||a;for(var u=0;u<c.length;u++)o[t]?o[t](c[u],s[e],v):o["on"+c[u]]=n?s[e]:null}return r.bind(null,!n)}(t)}}function u(r,n){if(t(r))return n?u(document.querySelectorAll(r)):r.split(" ").map(function(r){return r.trim()});if(NodeList.prototype.isPrototypeOf(r)){for(var o=[],i=r.length>>>0;i--;)o[i]=r[i];return o}return e(r)?r:[r]}function i(r,n){return n&&n.once?l(r):r}function l(r,n){var t;return function(){return r&&(t=r.apply(n||this,arguments),r=null),t}}var f=o("Event"),a=o();export{f as addListener,l as once,a as removeListener}; | ||
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}; | ||
//# sourceMappingURL=analytics-util-listener.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@analytics/type-utils")):"function"==typeof define&&define.amd?define(["exports","@analytics/type-utils"],n):n((e||self).utilListener={},e.typeUtils)}(this,function(e,n){function t(e){return function(t,o,u,f){var l=u||n.noOp;if(!n.isBrowser)return l;var s=f||!1,a=r(o),c=r(t,!0),p=[];if(!c.length)throw new Error("noElements");if(!a.length)throw new Error("noEvent");return function e(n){var t=n?"addEventListener":"removeEventListener";n&&(p=[]);for(var r=0;r<c.length;r++){var o=c[r];p[r]=n?i(l,s):p[r]||l;for(var u=0;u<a.length;u++)o[t]?o[t](a[u],p[r],s):o["on"+a[u]]=n?p[r]:null}return e.bind(null,!n)}(e)}}function r(e,t){if(n.isString(e))return t?r(document.querySelectorAll(e)):e.split(" ").map(function(e){return e.trim()});if(NodeList.prototype.isPrototypeOf(e)){for(var i=[],o=e.length>>>0;o--;)i[o]=e[o];return i}return n.isArray(e)?e:[e]}function i(e,n){return n&&n.once?o(e):e}function o(e,n){var t;return function(){return e&&(t=e.apply(n||this,arguments),e=null),t}}var u=t("Event"),f=t();e.addListener=u,e.once=o,e.removeListener=f}); | ||
!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}); | ||
//# sourceMappingURL=analytics-util-listener.umd.js.map |
@@ -1,2 +0,2 @@ | ||
var utilListener=function(n){var e=function(){};"undefined"==typeof process||process;var r="undefined"!=typeof window;function t(n,e){return typeof e===n}"undefined"!=typeof Deno&&Deno,r&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),t.bind(null,"function");var o=t.bind(null,"string");function i(n){return function(t,o,i,l){var d=i||e;if(!r)return d;var a=l||!1,c=u(o),s=u(t,!0),v=[];if(!s.length)throw new Error("noElements");if(!c.length)throw new Error("noEvent");return function n(e){var r=e?"addEventListener":"removeEventListener";e&&(v=[]);for(var t=0;t<s.length;t++){var o=s[t];v[t]=e?f(d,a):v[t]||d;for(var i=0;i<c.length;i++)o[r]?o[r](c[i],v[t],a):o["on"+c[i]]=e?v[t]:null}return n.bind(null,!e)}(n)}}function u(n,e){if(o(n))return e?u(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"[object Array]"===Object.prototype.toString.call(n)?n:[n]}function f(n,e){return e&&e.once?l(n):n}function l(n,e){var r;return function(){return n&&(r=n.apply(e||this,arguments),n=null),r}}t.bind(null,"undefined"),t.bind(null,"boolean");var d=i("Event"),a=i();return n.addListener=d,n.once=l,n.removeListener=a,n}({}); | ||
var utilListener=function(n){var r=function(){};"undefined"==typeof process||process;var t="undefined"!=typeof window;function e(n,r){return r.charAt(0)[n]()+r.slice(1)}"undefined"!=typeof Deno&&Deno,t&&"nodejs"===window.name||"undefined"!=typeof navigator&&(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?w(n):n}function w(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 m=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=m,n.addWindowEvent=E,n.onError=L,n.onLoad=h,n.once=w,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 t="undefined"!=typeof window;function r(n,e){return typeof e===n}"undefined"!=typeof Deno&&Deno,t&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),r.bind(null,"function");var o=r.bind(null,"string");function i(n){return function(r,o,i,d){var l=i||e;if(!t)return l;var a=d||!1,s=u(o),c=u(r,!0),p=[];if(!c.length)throw new Error("noElements");if(!s.length)throw new Error("noEvent");return function n(e){var t=e?"addEventListener":"removeEventListener";e&&(p=[]);for(var r=0;r<c.length;r++){var o=c[r];p[r]=e?f(l,a):p[r]||l;for(var i=0;i<s.length;i++)o[t]?o[t](s[i],p[r],a):o["on"+s[i]]=e?p[r]:null}return n.bind(null,!e)}(n)}}function u(n,e){if(o(n))return e?u(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var t=[],r=n.length>>>0;r--;)t[r]=n[r];return t}return"[object Array]"===Object.prototype.toString.call(n)?n:[n]}function f(n,e){return e&&e.once?d(n):n}function d(n,e){var t;return function(){return n&&(t=n.apply(e||this,arguments),n=null),t}}r.bind(null,"undefined"),r.bind(null,"boolean");var l=i("Event"),a=i();n.addListener=l,n.once=d,n.removeListener=a}); | ||
!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 window;function t(n,e){return e.charAt(0)[n]()+e.slice(1)}"undefined"!=typeof Deno&&Deno,r&&"nodejs"===window.name||"undefined"!=typeof navigator&&(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 w=v("Event"),g=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=w,n.addWindowEvent=E,n.onError=h,n.onLoad=L,n.once=m,n.removeListener=g}); | ||
//# sourceMappingURL=listener-utils.umd.js.map |
{ | ||
"name": "@analytics/listener-utils", | ||
"version": "0.2.10", | ||
"version": "0.3.0", | ||
"description": "Backward compatible event listener library for attaching & detaching event handlers", | ||
@@ -51,3 +51,3 @@ "author": "David Wells", | ||
"esm": "^3.2.25", | ||
"microbundle": "^0.13.0", | ||
"microbundle": "^0.14.2", | ||
"servor": "^4.0.2", | ||
@@ -58,5 +58,5 @@ "uvu": "^0.5.1", | ||
"dependencies": { | ||
"@analytics/type-utils": "^0.5.4" | ||
"@analytics/type-utils": "^0.6.0" | ||
}, | ||
"gitHead": "104d15e3d891b1560459272443e11bf3b926028b" | ||
"gitHead": "911491fffca5df822a6d8eb5b6255e47983e338c" | ||
} |
@@ -74,5 +74,5 @@ <!-- | ||
const disableFetchListener = addListener('#api', 'click', () => { | ||
// Fetch in progress disable click handler to avoid duplicate calls | ||
const renableAPIClickHandler = disableFetchListener() | ||
const disableListener = addListener('#button-selector', 'click', (event) => { | ||
/* Fetch in progress.. Call disableListener to avoid duplicate calls */ | ||
const renable = disableListener() | ||
@@ -84,13 +84,21 @@ fetch(`https://swapi.dev/api/people/?search=l`) | ||
.then((json) => { | ||
console.log("data", json.results) | ||
console.log('data', json.results) | ||
// Success! Reattach event handler | ||
renableAPIClickHandler() | ||
renable() | ||
}) | ||
.catch((err) => { | ||
console.log('API error', err) | ||
// Error! Reattach event handler | ||
renableAPIClickHandler() | ||
// Error! Reattach event handler | ||
renable() | ||
}) | ||
}) | ||
// call disableFetchListener wherever you wish to disable this click handler | ||
/* | ||
HTML: | ||
<button id="button-selector"> | ||
Click Me | ||
</button> | ||
*/ | ||
``` | ||
@@ -97,0 +105,0 @@ |
/** | ||
* Element selector | ||
*/ | ||
export type Selector = (string | Node | NodeList | EventTarget | null); | ||
/** | ||
* Event to listen to | ||
*/ | ||
export type EventType = (string | string[]); | ||
/** | ||
* Cleanup event listener | ||
*/ | ||
export type RemoveListener = () => AttachListener; | ||
/** | ||
* ReAttach event listener | ||
*/ | ||
export type AttachListener = () => RemoveListener; | ||
/** | ||
* Add an event listener | ||
*/ | ||
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; | ||
/** | ||
* Run function once | ||
@@ -32,2 +8,3 @@ * @param {Function} fn - Function to run just once | ||
export function once(fn: Function, context?: any): (...args: any[]) => any; | ||
export function addWindowEvent(event: any, fn: any): any; | ||
/** | ||
@@ -75,1 +52,27 @@ * Element selector | ||
export const removeListener: RemoveEventListener; | ||
export const onError: (fn?: any) => any; | ||
export const onLoad: (fn?: any) => any; | ||
/** | ||
* Element selector | ||
*/ | ||
export type Selector = (string | Node | NodeList | EventTarget | null); | ||
/** | ||
* Event to listen to | ||
*/ | ||
export type EventType = (string | string[]); | ||
/** | ||
* Cleanup event listener | ||
*/ | ||
export type RemoveListener = () => AttachListener; | ||
/** | ||
* ReAttach event listener | ||
*/ | ||
export type AttachListener = () => RemoveListener; | ||
/** | ||
* Add an event listener | ||
*/ | ||
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; |
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
174
81108
17
125
1
+ Added@analytics/type-utils@0.6.2(transitive)
- Removed@analytics/type-utils@0.5.4(transitive)
Updated@analytics/type-utils@^0.6.0