toosoon-utils 1.0.6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/now.ts DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * Polyfill for "now()" functions
3
- */
4
- let now: () => number;
5
-
6
- // In node.js, use process.hrtime
7
- if (typeof process !== 'undefined' && process.hrtime) {
8
- now = function () {
9
- // Convert [seconds, nanoseconds] to milliseconds
10
- const time = process.hrtime();
11
- return time[0] * 1000 + time[1] / 1000000;
12
- };
13
- }
14
- // In a browser use performance or Date
15
- else if (typeof performance !== 'undefined') {
16
- // This must be bound, because directly assigning this function leads to an invocation exception in Chrome
17
- now = performance.now.bind(performance);
18
- } else if (typeof Date.now !== 'undefined') {
19
- now = Date.now;
20
- } else {
21
- now = function () {
22
- return new Date().getTime();
23
- };
24
- }
25
-
26
- export default now;