From dd1d6a0f67cb386941ddc08aa453612f8398144f Mon Sep 17 00:00:00 2001 From: Geert-Jan Zwiers Date: Fri, 6 May 2022 19:37:18 +0200 Subject: feat(web): add `performance.timeOrigin` (#14489) Add support for the `performance.timeOrigin` web API. Co-authored-by: Jovi De Croock --- cli/dts/lib.deno.shared_globals.d.ts | 1 + cli/tests/unit/performance_test.ts | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'cli') diff --git a/cli/dts/lib.deno.shared_globals.d.ts b/cli/dts/lib.deno.shared_globals.d.ts index 5f44e2d1b..b96c56dba 100644 --- a/cli/dts/lib.deno.shared_globals.d.ts +++ b/cli/dts/lib.deno.shared_globals.d.ts @@ -450,6 +450,7 @@ declare class Worker extends EventTarget { declare type PerformanceEntryList = PerformanceEntry[]; declare class Performance { + readonly timeOrigin: number; constructor(); /** Removes the stored timestamp with the associated name. */ diff --git a/cli/tests/unit/performance_test.ts b/cli/tests/unit/performance_test.ts index 4c7d08d4e..252a31fc4 100644 --- a/cli/tests/unit/performance_test.ts +++ b/cli/tests/unit/performance_test.ts @@ -20,6 +20,13 @@ Deno.test({ permissions: { hrtime: false } }, async function performanceNow() { assert(totalTime >= 10); }); +Deno.test(function timeOrigin() { + const origin = performance.timeOrigin; + + assert(origin > 0); + assert(Date.now() >= origin); +}); + Deno.test(function performanceMark() { const mark = performance.mark("test"); assert(mark instanceof PerformanceMark); -- cgit v1.2.3