@analytics/activity-utils
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.11](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-activity/compare/@analytics/activity-utils@0.1.10...@analytics/activity-utils@0.1.11) (2022-01-03) | ||
**Note:** Version bump only for package @analytics/activity-utils | ||
## [0.1.10](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-activity/compare/@analytics/activity-utils@0.1.9...@analytics/activity-utils@0.1.10) (2022-01-02) | ||
@@ -8,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
var utilActivity=function(n){function t(){return(t=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n}).apply(this,arguments)}var e=function(){};"undefined"==typeof process||process;var r="undefined"!=typeof window;function o(n,t){if(function(n){return"string"==typeof n}(n))return t?o(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var e=[],r=n.length>>>0;r--;)e[r]=n[r];return e}return function(n){return"[object Array]"===Object.prototype.toString.call(n)}(n)?n:[n]}function i(n,t){return t&&t.once?function(n,t){var e;return function(){return n&&(e=n.apply(this,arguments),n=null),e}}(n):n}"undefined"!=typeof Deno&&Deno,r&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var u=function(n,t,u,c){var a=u||e;if(!r)return a;var f=c||!1,d=o(t),l=o(n,!0),v=[];if(!l.length)throw new Error("noElements");if(!d.length)throw new Error("noEvent");return function n(t){var e=t?"addEventListener":"removeEventListener";t&&(v=[]);for(var r=0;r<l.length;r++){var o=l[r];v[r]=t?i(a,f):v[r]||a;for(var u=0;u<d.length;u++)o[e]?o[e](d[u],v[r],f):o["on"+d[u]]=t?v[r]:null}return n.bind(null,!t)}("Event")},c="undefined"==typeof window,a="hidden",f=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function d(n,t){void 0===t&&(t={});var e=function(n,t){var e=this,r=!1;return function(o){r||(n.call(e,o),r=!0,setTimeout(function(){return r=!1},t))}}(n,t.throttle||1e4),r=[];function o(){var n=function(n){if(c)return!1;var t=c||a in document?a:["webkit","moz","ms","o"].reduce(function(n,t){var e=t+"Hidden";return!n&&e in document?e:n},null),e="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return n(Boolean(document[t]))},o=function(){return document.addEventListener(e,r)};return o(),function(){return document.removeEventListener(e,r),o}}(function(n){n||e({type:"tabVisible"})});return r=[n].concat(f.map(function(n){return u(document,n,e)})).concat(u(window,"load",e)).concat(u(window,"scroll",e,{capture:!0,passive:!0})),i}function i(){r.map(function(n){return n()})}return o(),function(){return i(),o}}function l(n){var t,e,r=n.onIdle,o=n.onWakeUp,i=n.onHeartbeat,u=n.timeout,c=void 0===u?1e4:u,a=n.throttle,f=void 0===a?2e3:a,l=!1,s=!1,p=new Date,m=function(){return clearTimeout(t)};function w(n){m(),i&&!l&&i(v(p),n),o&&l&&(l=!1,o(v(e),n),p=new Date),t=setTimeout(function(){l=!0,r&&(e=new Date,r(v(p),n))},c)}var h=d(w,{throttle:f});return{disable:function(){s=!0,l=!1,m();var n=h();return function(){return s=!1,p=new Date,w({type:"load"}),n()}},getStatus:function(){return{isIdle:l,isDisabled:s,active:l?0:v(p,s),idle:l?v(e,s):0}}}}function v(n,t){return t?0:Math.round((new Date-n)/1e3)}return n.onDomActivity=d,n.onIdle=function(n,e){return void 0===e&&(e={}),l(t({onIdle:n},e))},n.onUserActivity=l,n.onWakeUp=function(n,e){return void 0===e&&(e={}),l(t({onWakeUp:n},e))},n}({}); | ||
var utilActivity=function(n){function t(){return(t=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r])}return n}).apply(this,arguments)}var e=function(){};"undefined"==typeof process||process;var r="undefined"!=typeof window;function o(n,t){return typeof t===n}"undefined"!=typeof Deno&&Deno,r&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),o.bind(null,"function");var i=o.bind(null,"string");function u(n,t){if(i(n))return t?u(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var e=[],r=n.length>>>0;r--;)e[r]=n[r];return e}return function(n){return"[object Array]"===Object.prototype.toString.call(n)}(n)?n:[n]}function c(n,t){return t&&t.once?function(n,t){var e;return function(){return n&&(e=n.apply(this,arguments),n=null),e}}(n):n}o.bind(null,"undefined"),o.bind(null,"boolean");var a=function(n,t,o,i){var a=o||e;if(!r)return a;var d=i||!1,f=u(t),l=u(n,!0),v=[];if(!l.length)throw new Error("noElements");if(!f.length)throw new Error("noEvent");return function n(t){var e=t?"addEventListener":"removeEventListener";t&&(v=[]);for(var r=0;r<l.length;r++){var o=l[r];v[r]=t?c(a,d):v[r]||a;for(var i=0;i<f.length;i++)o[e]?o[e](f[i],v[r],d):o["on"+f[i]]=t?v[r]:null}return n.bind(null,!t)}("Event")},d="undefined"==typeof window,f="hidden",l=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function v(n,t){void 0===t&&(t={});var e=function(n,t){var e=this,r=!1;return function(o){r||(n.call(e,o),r=!0,setTimeout(function(){return r=!1},t))}}(n,t.throttle||1e4),r=[];function o(){var n=function(n){if(d)return!1;var t=d||f in document?f:["webkit","moz","ms","o"].reduce(function(n,t){var e=t+"Hidden";return!n&&e in document?e:n},null),e="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),r=function(){return n(Boolean(document[t]))},o=function(){return document.addEventListener(e,r)};return o(),function(){return document.removeEventListener(e,r),o}}(function(n){n||e({type:"tabVisible"})});return r=[n].concat(l.map(function(n){return a(document,n,e)})).concat(a(window,"load",e)).concat(a(window,"scroll",e,{capture:!0,passive:!0})),i}function i(){r.map(function(n){return n()})}return o(),function(){return i(),o}}function s(n){var t,e,r=n.onIdle,o=n.onWakeUp,i=n.onHeartbeat,u=n.timeout,c=void 0===u?1e4:u,a=n.throttle,d=void 0===a?2e3:a,f=!1,l=!1,s=new Date,m=function(){return clearTimeout(t)};function w(n){m(),i&&!f&&i(p(s),n),o&&f&&(f=!1,o(p(e),n),s=new Date),t=setTimeout(function(){f=!0,r&&(e=new Date,r(p(s),n))},c)}var h=v(w,{throttle:d});return{disable:function(){l=!0,f=!1,m();var n=h();return function(){return l=!1,s=new Date,w({type:"load"}),n()}},getStatus:function(){return{isIdle:f,isDisabled:l,active:f?0:p(s,l),idle:f?p(e,l):0}}}}function p(n,t){return t?0:Math.round((new Date-n)/1e3)}return n.onDomActivity=v,n.onIdle=function(n,e){return void 0===e&&(e={}),s(t({onIdle:n},e))},n.onUserActivity=s,n.onWakeUp=function(n,e){return void 0===e&&(e={}),s(t({onWakeUp:n},e))},n}({}); | ||
//# sourceMappingURL=activity-utils.js.map |
@@ -1,2 +0,2 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n||self).utilActivity={})}(this,function(n){function t(){return(t=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o])}return n}).apply(this,arguments)}var e=function(){};"undefined"==typeof process||process;var o="undefined"!=typeof window;function r(n,t){if(function(n){return"string"==typeof n}(n))return t?r(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var e=[],o=n.length>>>0;o--;)e[o]=n[o];return e}return function(n){return"[object Array]"===Object.prototype.toString.call(n)}(n)?n:[n]}function i(n,t){return t&&t.once?function(n,t){var e;return function(){return n&&(e=n.apply(this,arguments),n=null),e}}(n):n}"undefined"!=typeof Deno&&Deno,o&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));var u=function(n,t,u,c){var a=u||e;if(!o)return a;var f=c||!1,d=r(t),l=r(n,!0),s=[];if(!l.length)throw new Error("noElements");if(!d.length)throw new Error("noEvent");return function n(t){var e=t?"addEventListener":"removeEventListener";t&&(s=[]);for(var o=0;o<l.length;o++){var r=l[o];s[o]=t?i(a,f):s[o]||a;for(var u=0;u<d.length;u++)r[e]?r[e](d[u],s[o],f):r["on"+d[u]]=t?s[o]:null}return n.bind(null,!t)}("Event")},c="undefined"==typeof window,a="hidden",f=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function d(n,t){void 0===t&&(t={});var e=function(n,t){var e=this,o=!1;return function(r){o||(n.call(e,r),o=!0,setTimeout(function(){return o=!1},t))}}(n,t.throttle||1e4),o=[];function r(){var n=function(n){if(c)return!1;var t=c||a in document?a:["webkit","moz","ms","o"].reduce(function(n,t){var e=t+"Hidden";return!n&&e in document?e:n},null),e="".concat(t.replace(/[H|h]idden/,""),"visibilitychange"),o=function(){return n(Boolean(document[t]))},r=function(){return document.addEventListener(e,o)};return r(),function(){return document.removeEventListener(e,o),r}}(function(n){n||e({type:"tabVisible"})});return o=[n].concat(f.map(function(n){return u(document,n,e)})).concat(u(window,"load",e)).concat(u(window,"scroll",e,{capture:!0,passive:!0})),i}function i(){o.map(function(n){return n()})}return r(),function(){return i(),r}}function l(n){var t,e,o=n.onIdle,r=n.onWakeUp,i=n.onHeartbeat,u=n.timeout,c=void 0===u?1e4:u,a=n.throttle,f=void 0===a?2e3:a,l=!1,v=!1,p=new Date,m=function(){return clearTimeout(t)};function y(n){m(),i&&!l&&i(s(p),n),r&&l&&(l=!1,r(s(e),n),p=new Date),t=setTimeout(function(){l=!0,o&&(e=new Date,o(s(p),n))},c)}var h=d(y,{throttle:f});return{disable:function(){v=!0,l=!1,m();var n=h();return function(){return v=!1,p=new Date,y({type:"load"}),n()}},getStatus:function(){return{isIdle:l,isDisabled:v,active:l?0:s(p,v),idle:l?s(e,v):0}}}}function s(n,t){return t?0:Math.round((new Date-n)/1e3)}n.onDomActivity=d,n.onIdle=function(n,e){return void 0===e&&(e={}),l(t({onIdle:n},e))},n.onUserActivity=l,n.onWakeUp=function(n,e){return void 0===e&&(e={}),l(t({onWakeUp:n},e))}}); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n||self).utilActivity={})}(this,function(n){function e(){return(e=Object.assign||function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n}).apply(this,arguments)}var t=function(){};"undefined"==typeof process||process;var o="undefined"!=typeof window;function r(n,e){return typeof e===n}"undefined"!=typeof Deno&&Deno,o&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),r.bind(null,"function");var i=r.bind(null,"string");function u(n,e){if(i(n))return e?u(document.querySelectorAll(n)):n.split(" ").map(function(n){return n.trim()});if(NodeList.prototype.isPrototypeOf(n)){for(var t=[],o=n.length>>>0;o--;)t[o]=n[o];return t}return function(n){return"[object Array]"===Object.prototype.toString.call(n)}(n)?n:[n]}function c(n,e){return e&&e.once?function(n,e){var t;return function(){return n&&(t=n.apply(this,arguments),n=null),t}}(n):n}r.bind(null,"undefined"),r.bind(null,"boolean");var a=function(n,e,r,i){var a=r||t;if(!o)return a;var f=i||!1,d=u(e),l=u(n,!0),s=[];if(!l.length)throw new Error("noElements");if(!d.length)throw new Error("noEvent");return function n(e){var t=e?"addEventListener":"removeEventListener";e&&(s=[]);for(var o=0;o<l.length;o++){var r=l[o];s[o]=e?c(a,f):s[o]||a;for(var i=0;i<d.length;i++)r[t]?r[t](d[i],s[o],f):r["on"+d[i]]=e?s[o]:null}return n.bind(null,!e)}("Event")},f="undefined"==typeof window,d="hidden",l=["mousemove","mousedown","touchmove","touchstart","touchend","keydown"];function s(n,e){void 0===e&&(e={});var t=function(n,e){var t=this,o=!1;return function(r){o||(n.call(t,r),o=!0,setTimeout(function(){return o=!1},e))}}(n,e.throttle||1e4),o=[];function r(){var n=function(n){if(f)return!1;var e=f||d in document?d:["webkit","moz","ms","o"].reduce(function(n,e){var t=e+"Hidden";return!n&&t in document?t:n},null),t="".concat(e.replace(/[H|h]idden/,""),"visibilitychange"),o=function(){return n(Boolean(document[e]))},r=function(){return document.addEventListener(t,o)};return r(),function(){return document.removeEventListener(t,o),r}}(function(n){n||t({type:"tabVisible"})});return o=[n].concat(l.map(function(n){return a(document,n,t)})).concat(a(window,"load",t)).concat(a(window,"scroll",t,{capture:!0,passive:!0})),i}function i(){o.map(function(n){return n()})}return r(),function(){return i(),r}}function v(n){var e,t,o=n.onIdle,r=n.onWakeUp,i=n.onHeartbeat,u=n.timeout,c=void 0===u?1e4:u,a=n.throttle,f=void 0===a?2e3:a,d=!1,l=!1,v=new Date,m=function(){return clearTimeout(e)};function y(n){m(),i&&!d&&i(p(v),n),r&&d&&(d=!1,r(p(t),n),v=new Date),e=setTimeout(function(){d=!0,o&&(t=new Date,o(p(v),n))},c)}var h=s(y,{throttle:f});return{disable:function(){l=!0,d=!1,m();var n=h();return function(){return l=!1,v=new Date,y({type:"load"}),n()}},getStatus:function(){return{isIdle:d,isDisabled:l,active:d?0:p(v,l),idle:d?p(t,l):0}}}}function p(n,e){return e?0:Math.round((new Date-n)/1e3)}n.onDomActivity=s,n.onIdle=function(n,t){return void 0===t&&(t={}),v(e({onIdle:n},t))},n.onUserActivity=v,n.onWakeUp=function(n,t){return void 0===t&&(t={}),v(e({onWakeUp:n},t))}}); | ||
//# sourceMappingURL=activity-utils.umd.js.map |
{ | ||
"name": "@analytics/activity-utils", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "User activity listener utilities", | ||
@@ -52,6 +52,6 @@ "author": "David Wells", | ||
"dependencies": { | ||
"@analytics/listener-utils": "^0.2.8", | ||
"@analytics/listener-utils": "^0.2.9", | ||
"analytics-plugin-tab-events": "^0.2.1" | ||
}, | ||
"gitHead": "a4209ddf2b3db2311e7660377f1a1931b16103fa" | ||
"gitHead": "189675c59b0f69f2f2d3d3453d6a2d4d93393b0e" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
351516
6514