summaryrefslogtreecommitdiff
path: root/cli/js/lib.deno.ns.d.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-07-11 12:38:15 +1000
committerGitHub <noreply@github.com>2020-07-10 22:38:15 -0400
commit40d081d3d9f64bcd2524da86fb78808ac1d7b888 (patch)
tree2232fda10c06d80d749f975b691974c506caa63d /cli/js/lib.deno.ns.d.ts
parentd01eb6d9c506eef765fde8e40f9b90619b2ec83c (diff)
feat: add performance user timing APIs (#6421)
Diffstat (limited to 'cli/js/lib.deno.ns.d.ts')
-rw-r--r--cli/js/lib.deno.ns.d.ts44
1 files changed, 44 insertions, 0 deletions
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 @@
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
+/** 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.
*