mirror of
https://github.com/denoland/deno.git
synced 2025-09-29 21:54:48 +00:00
feat: add performance user timing APIs (#6421)
This commit is contained in:
parent
d01eb6d9c5
commit
40d081d3d9
17 changed files with 536 additions and 26 deletions
44
cli/js/lib.deno.ns.d.ts
vendored
44
cli/js/lib.deno.ns.d.ts
vendored
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue