analytics-utils
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.3.0](https://github.com/DavidWells/analytics/compare/analytics-utils@0.2.2...analytics-utils@0.3.0) (2020-12-02) | ||
### Features | ||
* add scroll util ([eb6aa1a](https://github.com/DavidWells/analytics/commit/eb6aa1a)) | ||
## [0.2.2](https://github.com/DavidWells/analytics/compare/analytics-utils@0.2.1...analytics-utils@0.2.2) (2020-07-14) | ||
@@ -8,0 +19,0 @@ |
@@ -735,2 +735,37 @@ var analyticsUtils = (function (exports) { | ||
function throttle(func, wait) { | ||
var context, args, result; | ||
var timeout = null; | ||
var previous = 0; | ||
var later = function later() { | ||
previous = new Date(); | ||
timeout = null; | ||
result = func.apply(context, args); | ||
}; | ||
return function () { | ||
var now = new Date(); | ||
if (!previous) { | ||
previous = now; | ||
} | ||
var remaining = wait - (now - previous); | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
previous = now; | ||
result = func.apply(context, args); | ||
} else if (!timeout) { | ||
timeout = setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
} | ||
exports.storage = index; | ||
@@ -761,2 +796,3 @@ exports.getCookie = getCookie; | ||
exports.uuid = uuid; | ||
exports.throttle = throttle; | ||
@@ -763,0 +799,0 @@ return exports; |
@@ -1,1 +0,1 @@ | ||
var analyticsUtils=function(e){"use strict";function t(e,t,n,r,o,c){if("undefined"!=typeof window)return 1<arguments.length?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(o?"; domain="+o:"")+(c?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}var u=t,l=t;function r(e){return t(e,"",-1)}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(t){var n;try{void 0===(n=JSON.parse(t))&&(n=t),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==o(n)&&(n=parseFloat(n))}catch(e){n=t}return n}var s="object"===("undefined"==typeof self?"undefined":o(self))&&self.self===self&&self||"object"===("undefined"==typeof global?"undefined":o(global))&&global.global===global&&global||void 0,m="localStorage",g="cookie",d="global",n=!1,c=function(){try{t("_c_","1");var e=-1!==document.cookie.indexOf("_c_");return t("_c_","",-1),e}catch(e){return!1}}();function p(e){return"string"==typeof e?e:e.storage}function v(e){return n&&(!e||e===m)}function y(e){return c&&(!e||e===g)}var a={getItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;var n,r=p(t);if("all"===r)return{cookie:f(u(n=e)),localStorage:f(localStorage.getItem(n)),global:s[n]||null};if(v(r)){var o=localStorage.getItem(e);if(o||r===m)return f(o)}if(y(r)){var c=u(e);if(c||r===g)return f(c)}return s[e]||null},setItem:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return!1;var r=p(n),o=JSON.stringify(t);if(v(r)){var c=f(localStorage.getItem(e));return localStorage.setItem(e,o),{value:t,oldValue:c,location:m}}if(y(r)){var a=f(u(e));return l(e,o),{value:t,oldValue:a,location:g}}var i=s[e];return{value:s[e]=t,oldValue:i,location:d}},removeItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;var n=p(t);return v(n)?(localStorage.removeItem(e),m):y(n)?(r(e),g):(s[e]=void 0,d)}};function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}var h="undefined"!=typeof document;function S(e){if(!h)return!1;var t=e||document.referrer;if(t){var n=window.document.location.port,r=t.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function w(e,t){var n=(e.split("?")||[,])[1];if(!n||-1===n.indexOf(t))return e;var r=new RegExp("(\\&|\\?)".concat(t,'([_A-Za-z0-9"+=.\\/\\-@%]+)'),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return e.replace("?".concat(n),o)}function O(e){var t=function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return h&&window.location.search.substring(1)}(e);return t?function(e){var t,n=/([^&=]+)=?([^&]*)/g,r={};for(;t=n.exec(e);){var o=b(t[1]),c=b(t[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(c);else{var a=""===c||c;r[o]=a}}for(var i in r){var u=i.split("[");if(1<u.length){var l=[];u.forEach(function(e,t){var n=e.replace(/[?[\]\\ ]/g,"");l.push(n)}),j(r,l,r[i]),delete r[i]}}return r}(t):{}}function j(e,t,n){for(var r=t.length-1,o=0;o<r;++o){var c=t[o];c in e||(e[c]={}),e=e[c]}e[t[r]]=n}function x(e){if(!h)return null;var t=document.createElement("a");return t.setAttribute("href",e),t.hostname}function I(e){return(x(e)||"").split(".").slice(-2).join(".")}function k(e){var t=e.split(".");return 1<t.length?t.slice(0,-1).join("."):e}var R={trimTld:k,getDomainBase:I,getDomainHost:x},_="google";var C="q",E="query",D={"daum.net":C,"eniro.se":"search_word","naver.com":E,"yahoo.com":"p","msn.com":C,"aol.com":C,"lycos.com":C,"ask.com":C,"cnn.com":E,"about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":C,"search.com":C,"yam.com":"k","kvasir.no":C,"terra.com":E,"mynet.com":C,"rambler.ru":"words",google:C,"bing.com":{p:C,n:"live"}};function P(){return 4294967295*Math.random()|0}return e.storage=a,e.getCookie=u,e.setCookie=l,e.globalContext=s,e.removeCookie=r,e.isFunction=function(e){return"function"==typeof e},e.isString=function(e){return"string"==typeof e},e.isObject=function(e){if("object"!==i(e)||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},e.isUndefined=function(e){return void 0===e},e.isBoolean=function(e){return"boolean"==typeof e},e.dotProp=function(e,t,n,r,o){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:o;return e===o?n:e},e.decodeUri=b,e.getBrowserLocale=function(){if(!h)return null;var e=navigator,t=e.language,n=e.languages,r=e.userLanguage;return n&&n.length?n[0]:r||t},e.getTimeZone=function(){return"undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone},e.inBrowser=h,e.isExternalReferrer=S,e.isScriptLoaded=function(n){if(!h)return!0;var r=document.getElementsByTagName("script");return!!Object.keys(r).filter(function(e){var t=r[e].src;return"string"==typeof n?-1!==t.indexOf(n):n instanceof RegExp&&t.match(n)}).length},e.noOp=function(){},e.paramsClean=w,e.paramsGet=function(e,t){return b((RegExp("".concat(e,"=(.+?)(&|$)")).exec(t)||[,""])[1])},e.paramsParse=O,e.paramsRemove=function(o,c){return h?new Promise(function(e,t){if(window.history&&window.history.replaceState){var n=window.location.href,r=w(n,o);n!==r&&history.replaceState({},"",r)}return c&&c(),e()}):Promise.resolve()},e.parseReferrer=function(e,t){if(!h)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};e&&S(e)&&(n.referrer=e);var r=function(e){if(!e||!h)return!1;var t=I(e),n=document.createElement("a");if(n.href=e,-1<n.hostname.indexOf(_)&&(t=_),D[t]){var r=D[t],o="string"==typeof r?r:r.p,c=new RegExp(o+"=.*?([^&#]*|$)","gi"),a=n.search.match(c);return{source:r.n||k(t),medium:"organic",term:(a?a[0].split("=")[1]:"")||"(not provided)"}}var i=S(e)?"referral":"internal";return{source:n.hostname,medium:i}}(e);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=O(t),c=Object.keys(o);if(c.length){var a=c.reduce(function(e,t){return t.match(/^utm_/)&&(e["".concat(t.replace(/^utm_/,""))]=o[t]),t.match(/^(d|g)clid/)&&(e.source=_,e.medium=o.gclid?"cpc":"cpm",e[t]=o[t]),e},{});n=Object.assign({},n,a),(o.dclid||o.gclid)&&(n.source=_,n.medium=o.gclid?"cpc":"cpm")}return n},e.url=R,e.uuid=function(){for(var e,t,n,r,o=[],c=0;c<256;c++)o[c]=(c<16?"0":"")+c.toString(16);return e=P(),t=P(),n=P(),r=P(),"".concat(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255],"-").concat(o[255&t]).concat(o[t>>8&255],"-").concat(o[t>>16&15|64]).concat(o[t>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])},e}({}); | ||
var analyticsUtils=function(e){"use strict";function t(e,t,n,r,o,c){if("undefined"!=typeof window)return 1<arguments.length?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(o?"; domain="+o:"")+(c?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}var u=t,l=t;function r(e){return t(e,"",-1)}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(t){var n;try{void 0===(n=JSON.parse(t))&&(n=t),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==o(n)&&(n=parseFloat(n))}catch(e){n=t}return n}var s="object"===("undefined"==typeof self?"undefined":o(self))&&self.self===self&&self||"object"===("undefined"==typeof global?"undefined":o(global))&&global.global===global&&global||void 0,m="localStorage",p="cookie",g="global",n=!1,c=function(){try{t("_c_","1");var e=-1!==document.cookie.indexOf("_c_");return t("_c_","",-1),e}catch(e){return!1}}();function d(e){return"string"==typeof e?e:e.storage}function v(e){return n&&(!e||e===m)}function y(e){return c&&(!e||e===p)}var a={getItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;var n,r=d(t);if("all"===r)return{cookie:f(u(n=e)),localStorage:f(localStorage.getItem(n)),global:s[n]||null};if(v(r)){var o=localStorage.getItem(e);if(o||r===m)return f(o)}if(y(r)){var c=u(e);if(c||r===p)return f(c)}return s[e]||null},setItem:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return!1;var r=d(n),o=JSON.stringify(t);if(v(r)){var c=f(localStorage.getItem(e));return localStorage.setItem(e,o),{value:t,oldValue:c,location:m}}if(y(r)){var a=f(u(e));return l(e,o),{value:t,oldValue:a,location:p}}var i=s[e];return{value:s[e]=t,oldValue:i,location:g}},removeItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;var n=d(t);return v(n)?(localStorage.removeItem(e),m):y(n)?(r(e),p):(s[e]=void 0,g)}};function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}var h="undefined"!=typeof document;function w(e){if(!h)return!1;var t=e||document.referrer;if(t){var n=window.document.location.port,r=t.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function S(e,t){var n=(e.split("?")||[,])[1];if(!n||-1===n.indexOf(t))return e;var r=new RegExp("(\\&|\\?)".concat(t,'([_A-Za-z0-9"+=.\\/\\-@%]+)'),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return e.replace("?".concat(n),o)}function O(e){var t=function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return h&&window.location.search.substring(1)}(e);return t?function(e){var t,n=/([^&=]+)=?([^&]*)/g,r={};for(;t=n.exec(e);){var o=b(t[1]),c=b(t[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(c);else{var a=""===c||c;r[o]=a}}for(var i in r){var u=i.split("[");if(1<u.length){var l=[];u.forEach(function(e,t){var n=e.replace(/[?[\]\\ ]/g,"");l.push(n)}),j(r,l,r[i]),delete r[i]}}return r}(t):{}}function j(e,t,n){for(var r=t.length-1,o=0;o<r;++o){var c=t[o];c in e||(e[c]={}),e=e[c]}e[t[r]]=n}function x(e){if(!h)return null;var t=document.createElement("a");return t.setAttribute("href",e),t.hostname}function I(e){return(x(e)||"").split(".").slice(-2).join(".")}function k(e){var t=e.split(".");return 1<t.length?t.slice(0,-1).join("."):e}var R={trimTld:k,getDomainBase:I,getDomainHost:x},_="google";var C="q",D="query",E={"daum.net":C,"eniro.se":"search_word","naver.com":D,"yahoo.com":"p","msn.com":C,"aol.com":C,"lycos.com":C,"ask.com":C,"cnn.com":D,"about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":C,"search.com":C,"yam.com":"k","kvasir.no":C,"terra.com":D,"mynet.com":C,"rambler.ru":"words",google:C,"bing.com":{p:C,n:"live"}};function T(){return 4294967295*Math.random()|0}return e.storage=a,e.getCookie=u,e.setCookie=l,e.globalContext=s,e.removeCookie=r,e.isFunction=function(e){return"function"==typeof e},e.isString=function(e){return"string"==typeof e},e.isObject=function(e){if("object"!==i(e)||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},e.isUndefined=function(e){return void 0===e},e.isBoolean=function(e){return"boolean"==typeof e},e.dotProp=function(e,t,n,r,o){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:o;return e===o?n:e},e.decodeUri=b,e.getBrowserLocale=function(){if(!h)return null;var e=navigator,t=e.language,n=e.languages,r=e.userLanguage;return n&&n.length?n[0]:r||t},e.getTimeZone=function(){return"undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone},e.inBrowser=h,e.isExternalReferrer=w,e.isScriptLoaded=function(n){if(!h)return!0;var r=document.getElementsByTagName("script");return!!Object.keys(r).filter(function(e){var t=r[e].src;return"string"==typeof n?-1!==t.indexOf(n):n instanceof RegExp&&t.match(n)}).length},e.noOp=function(){},e.paramsClean=S,e.paramsGet=function(e,t){return b((RegExp("".concat(e,"=(.+?)(&|$)")).exec(t)||[,""])[1])},e.paramsParse=O,e.paramsRemove=function(o,c){return h?new Promise(function(e,t){if(window.history&&window.history.replaceState){var n=window.location.href,r=S(n,o);n!==r&&history.replaceState({},"",r)}return c&&c(),e()}):Promise.resolve()},e.parseReferrer=function(e,t){if(!h)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};e&&w(e)&&(n.referrer=e);var r=function(e){if(!e||!h)return!1;var t=I(e),n=document.createElement("a");if(n.href=e,-1<n.hostname.indexOf(_)&&(t=_),E[t]){var r=E[t],o="string"==typeof r?r:r.p,c=new RegExp(o+"=.*?([^&#]*|$)","gi"),a=n.search.match(c);return{source:r.n||k(t),medium:"organic",term:(a?a[0].split("=")[1]:"")||"(not provided)"}}var i=w(e)?"referral":"internal";return{source:n.hostname,medium:i}}(e);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=O(t),c=Object.keys(o);if(c.length){var a=c.reduce(function(e,t){return t.match(/^utm_/)&&(e["".concat(t.replace(/^utm_/,""))]=o[t]),t.match(/^(d|g)clid/)&&(e.source=_,e.medium=o.gclid?"cpc":"cpm",e[t]=o[t]),e},{});n=Object.assign({},n,a),(o.dclid||o.gclid)&&(n.source=_,n.medium=o.gclid?"cpc":"cpm")}return n},e.url=R,e.uuid=function(){for(var e,t,n,r,o=[],c=0;c<256;c++)o[c]=(c<16?"0":"")+c.toString(16);return e=T(),t=T(),n=T(),r=T(),"".concat(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255],"-").concat(o[255&t]).concat(o[t>>8&255],"-").concat(o[t>>16&15|64]).concat(o[t>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])},e.throttle=function(n,r){var o,c,a,i=null,u=0,l=function(){u=new Date,i=null,a=n.apply(o,c)};return function(){var e=new Date;u||(u=e);var t=r-(e-u);return o=this,c=arguments,t<=0?(clearTimeout(i),i=null,u=e,a=n.apply(o,c)):i||(i=setTimeout(l,t)),a}},e}({}); |
@@ -477,2 +477,37 @@ 'use strict'; | ||
function throttle(func, wait) { | ||
var context, args, result; | ||
var timeout = null; | ||
var previous = 0; | ||
var later = function later() { | ||
previous = new Date(); | ||
timeout = null; | ||
result = func.apply(context, args); | ||
}; | ||
return function () { | ||
var now = new Date(); | ||
if (!previous) { | ||
previous = now; | ||
} | ||
var remaining = wait - (now - previous); | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
previous = now; | ||
result = func.apply(context, args); | ||
} else if (!timeout) { | ||
timeout = setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
} | ||
exports.dotProp = dlv; | ||
@@ -503,1 +538,2 @@ exports.storage = storageUtils__default; | ||
exports.uuid = uuid; | ||
exports.throttle = throttle; |
@@ -470,2 +470,37 @@ export { default as dotProp } from 'dlv'; | ||
export { isFunction, isString, isObject, isUndefined, isBoolean, decode as decodeUri, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, url, uuid }; | ||
function throttle(func, wait) { | ||
var context, args, result; | ||
var timeout = null; | ||
var previous = 0; | ||
var later = function later() { | ||
previous = new Date(); | ||
timeout = null; | ||
result = func.apply(context, args); | ||
}; | ||
return function () { | ||
var now = new Date(); | ||
if (!previous) { | ||
previous = now; | ||
} | ||
var remaining = wait - (now - previous); | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
previous = now; | ||
result = func.apply(context, args); | ||
} else if (!timeout) { | ||
timeout = setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
} | ||
export { isFunction, isString, isObject, isUndefined, isBoolean, decode as decodeUri, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, url, uuid, throttle }; |
@@ -477,2 +477,37 @@ 'use strict'; | ||
function throttle(func, wait) { | ||
var context, args, result; | ||
var timeout = null; | ||
var previous = 0; | ||
var later = function later() { | ||
previous = new Date(); | ||
timeout = null; | ||
result = func.apply(context, args); | ||
}; | ||
return function () { | ||
var now = new Date(); | ||
if (!previous) { | ||
previous = now; | ||
} | ||
var remaining = wait - (now - previous); | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
previous = now; | ||
result = func.apply(context, args); | ||
} else if (!timeout) { | ||
timeout = setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
} | ||
exports.dotProp = dlv; | ||
@@ -503,1 +538,2 @@ exports.storage = storageUtils__default; | ||
exports.uuid = uuid; | ||
exports.throttle = throttle; |
@@ -470,2 +470,37 @@ export { default as dotProp } from 'dlv'; | ||
export { isFunction, isString, isObject, isUndefined, isBoolean, decode as decodeUri, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, url, uuid }; | ||
function throttle(func, wait) { | ||
var context, args, result; | ||
var timeout = null; | ||
var previous = 0; | ||
var later = function later() { | ||
previous = new Date(); | ||
timeout = null; | ||
result = func.apply(context, args); | ||
}; | ||
return function () { | ||
var now = new Date(); | ||
if (!previous) { | ||
previous = now; | ||
} | ||
var remaining = wait - (now - previous); | ||
context = this; | ||
args = arguments; | ||
if (remaining <= 0) { | ||
clearTimeout(timeout); | ||
timeout = null; | ||
previous = now; | ||
result = func.apply(context, args); | ||
} else if (!timeout) { | ||
timeout = setTimeout(later, remaining); | ||
} | ||
return result; | ||
}; | ||
} | ||
export { isFunction, isString, isObject, isUndefined, isBoolean, decode as decodeUri, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, url, uuid, throttle }; |
{ | ||
"name": "analytics-utils", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Analytics utility functions used by 'analytics' module", | ||
@@ -63,3 +63,3 @@ "author": "David Wells <hello@davidwells.io>", | ||
}, | ||
"gitHead": "6235efa2a3431d781a29a91c82e4aeb2b2aec1d9" | ||
"gitHead": "4bff065f524a5e6aaca6ac518917f515b84f572e" | ||
} |
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
93385
2395