From 40d081d3d9f64bcd2524da86fb78808ac1d7b888 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Sat, 11 Jul 2020 12:38:15 +1000 Subject: feat: add performance user timing APIs (#6421) --- cli/js/lib.deno.ns.d.ts | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'cli/js/lib.deno.ns.d.ts') diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index 0b46a0c4d..41243d0ca 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -3,6 +3,9 @@ /// /// +/** Deno provides extra properties on `import.meta`. These are included here + * to ensure that these are still available when using the Deno namepsace in + * conjunction with other type libs, like `dom`. */ declare interface ImportMeta { /** A string representation of the fully qualified module URL. */ url: string; @@ -19,6 +22,47 @@ declare interface ImportMeta { main: boolean; } +/** Deno supports user timing Level 3 (see: https://w3c.github.io/user-timing) + * which is not widely supported yet in other runtimes. These types are here + * so that these features are still available when using the Deno namespace + * in conjunction with other type libs, like `dom`. */ +declare interface Performance { + /** Stores a timestamp with the associated name (a "mark"). */ + mark(markName: string, options?: PerformanceMarkOptions): PerformanceMark; + + /** Stores the `DOMHighResTimeStamp` duration between two marks along with the + * associated name (a "measure"). */ + measure( + measureName: string, + options?: PerformanceMeasureOptions + ): PerformanceMeasure; +} + +declare interface PerformanceMarkOptions { + /** Metadata to be included in the mark. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + detail?: any; + + /** Timestamp to be used as the mark time. */ + startTime?: number; +} + +declare interface PerformanceMeasureOptions { + /** Metadata to be included in the measure. */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + detail?: any; + + /** Timestamp to be used as the start time or string to be used as start + * mark.*/ + start?: string | number; + + /** Duration between the start and end times. */ + duration?: number; + + /** Timestamp to be used as the end time or string to be used as end mark. */ + end?: string | number; +} + declare interface Permissions { /** Resolves to the current status of a permission. * -- cgit v1.2.3