Skip to content

Commit fd95aae

Browse files
authored
fix: add type definitions of Performance APIs (#841)
1 parent 98e8c99 commit fd95aae

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

types/globals.d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,3 +1846,43 @@ type KeyFormat =
18461846
// | "spki";
18471847
type KeyType = "private" | "public" | "secret";
18481848
type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
1849+
1850+
/**
1851+
* EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them.
1852+
*
1853+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget)
1854+
* @group DOM Events
1855+
*/
1856+
interface EventTarget {
1857+
//addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
1858+
//dispatchEvent(event: Event): boolean;
1859+
//removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
1860+
}
1861+
1862+
/**
1863+
* Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API.
1864+
*
1865+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance)
1866+
* @group Performance APIs
1867+
*/
1868+
interface Performance extends EventTarget {
1869+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/timeOrigin) */
1870+
readonly timeOrigin: DOMHighResTimeStamp;
1871+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Performance/now) */
1872+
now(): DOMHighResTimeStamp;
1873+
}
1874+
1875+
/**
1876+
* @group Performance APIs
1877+
*/
1878+
declare var Performance: {
1879+
prototype: Performance;
1880+
new(): Performance;
1881+
};
1882+
1883+
/**
1884+
* @group Performance APIs
1885+
*/
1886+
declare var performance: Performance;
1887+
1888+
type DOMHighResTimeStamp = number;

0 commit comments

Comments
 (0)