diff --git a/README.md b/README.md index 1e399df..f029044 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,66 @@ setTimeout(()=>{ }, 800); ``` + +## UMD +``` + + + +
+ + + + + + + + + +``` \ No newline at end of file diff --git a/lib/umd/index.js b/lib/umd/index.js index 2ea4d52..68ec3c1 100644 --- a/lib/umd/index.js +++ b/lib/umd/index.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Elapsed_logger={})}(this,(function(e){"use strict";var t="undefined"!=typeof process&&void 0!==process.hrtime?process.hrtime:function(e){var t=Math.floor(.001*(Date.now()-performance.now())),o=.001*performance.now(),n=Math.floor(o)+t,r=Math.floor(o%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},o=function(){function e(){this._timer=t()}return e.prototype.end=function(e){void 0===e&&(e="");var t=this.get();console.log((e?e+" ":"")+t)},e.prototype._diff=function(){return t(this._timer)},e.prototype.get=function(){var e=this._diff();return this.parse(e)},e.prototype.parse=function(e){var t="",o=(1e9*e[0]+e[1])/1e6,n=Math.round(o%1e3),r=Math.round(100*(o/1e3%60+Number.EPSILON))/100,f=Math.floor(o/6e4%60),i=Math.floor(o/36e5%24);return i>0&&(t+=i+" hours "),f>0&&(t+=f+" minutes "),r>=1&&(t+=r+" seconds "),0===f&&0===i&&r<1&&n>0&&(t+=n+"ms"),t},e}(),n=new Map,r=function(e){void 0===e&&(e=null);var t=new o;return e?(n.set(e,t),t):t},f=function(e,t){void 0===t&&(t=null);var o=i(e);!1!==o&&(console.log((t||e)+" "+o),n.delete(e))},i=function(e){var t=n.get(e);return t?t.get():(console.warn("No such label '"+e+"' for ElapsedLogger"),!1)},s={get:i,end:f,start:r};e.default=s,e.end=f,e.get=i,e.start=r,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file +!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e=e||self).Elapsed_logger={})}(this,(function(e){"use strict";var o=function(e){var o=Math.floor(.001*(Date.now()-performance.now())),t=.001*performance.now(),r=Math.floor(t)+o,n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]};o.bigint=function(e){var t=o(e);return 1e9*t[0]+t[1]},"undefined"!=typeof process&&void 0!==process.hrtime||(window.process={},window.process.hrtime=o),"object"==typeof e&&"undefined"!=typeof module&&(module.exports=process.hrtime);var t=process.hrtime,r=function(){function e(){this._timer=t()}return e.prototype.end=function(e){void 0===e&&(e="");var o=this.get();console.log((e?e+" ":"")+o)},e.prototype._diff=function(){return t(this._timer)},e.prototype.get=function(){var e=this._diff();return this.parse(e)},e.prototype.parse=function(e){var o="",t=(1e9*e[0]+e[1])/1e6,r=Math.round(t%1e3),n=Math.round(100*(t/1e3%60+Number.EPSILON))/100,i=Math.floor(t/6e4%60),s=Math.floor(t/36e5%24);return s>0&&(o+=s+" hours "),i>0&&(o+=i+" minutes "),n>=1&&(o+=n+" seconds "),0===i&&0===s&&n<1&&r>0&&(o+=r+"ms"),o},e}(),n=new Map,i=function(e){void 0===e&&(e=null);var o=new r;return e?(n.set(e,o),o):o},s=function(e,o){void 0===o&&(o=null);var t=f(e);!1!==t&&(console.log((o||e)+" "+t),n.delete(e))},f=function(e){var o=n.get(e);return o?o.get():(console.warn("No such label '"+e+"' for ElapsedLogger"),!1)},u={get:f,end:s,start:i};e.default=u,e.end=s,e.get=f,e.start=i,Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b0be645..af9980a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1750,9 +1750,9 @@ } }, "browser-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-hrtime/-/browser-hrtime-1.0.0.tgz", - "integrity": "sha512-74CwwOhtr0mO8d4TZNCBJQWFxJXPweBJ7z7y/RmQ6RM5A/NfbfLrOVn2yKJlghDGMAZbhIggEVTPHtz+8fwhNw==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/browser-hrtime/-/browser-hrtime-1.0.3.tgz", + "integrity": "sha512-zyfa/wU4Bcr2qlsyrbIb/5v2Qys0Q58/OICd1AZ7WOA/z0epRm4XPISRaFTdZkR6T2UEjVuWGnvDRVmYyzKqqg==" }, "browser-process-hrtime": { "version": "1.0.0", diff --git a/package.json b/package.json index df5835a..a79b895 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ }, "license": "MIT", "dependencies": { - "browser-hrtime": "^1.0.0" + "browser-hrtime": "^1.0.3" }, "devDependencies": { "@rollup/plugin-node-resolve": "^7.1.3", diff --git a/tests/umd.html b/tests/umd.html index 35ea781..014de3b 100644 --- a/tests/umd.html +++ b/tests/umd.html @@ -2,7 +2,6 @@ -