Reorganize file structure

This commit is contained in:
Slava Bacherikov committed 2018-04-10 14:00:53 +03:00
1 parent f6888b8872
commit b8a8d37e36
24 files changed
+3 -2

No files matched your search

@@ -0,0 +1,7 @@
import { monotonicTime } from "./performancePolyfill";
describe("Check performance.now polyfill", () => {
it("monotonicTime should return number", () => {
expect(typeof monotonicTime()).toEqual("number");
});
});
+20
View File
@@ -0,0 +1,20 @@
function makeMonotonicTime(): () => number {
if (typeof performance !== "undefined" && performance) {
let nowFun = performance.now ||
performance.webkitNow ||
performance.mozNow ||
performance.oNow ||
performance.msNow;
if (nowFun) {
return nowFun.bind(performance);
} else {
return Date.now;
}
} else {
return Date.now;
}
}
export const monotonicTime = makeMonotonicTime();