Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/typings/base-common.d.ts
3290 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
// Declare types that we probe for to implement util and/or polyfill functions
7
8
declare global {
9
10
// --- idle callbacks
11
12
interface IdleDeadline {
13
readonly didTimeout: boolean;
14
timeRemaining(): number;
15
}
16
17
function requestIdleCallback(callback: (args: IdleDeadline) => void, options?: { timeout: number }): number;
18
function cancelIdleCallback(handle: number): void;
19
20
21
// --- timeout / interval (available in all contexts, but different signatures in node.js vs web)
22
23
interface TimeoutHandle { readonly _: never; /* this is a trick that seems needed to prevent direct number assignment */ }
24
type Timeout = TimeoutHandle;
25
function setTimeout(handler: string | Function, timeout?: number, ...arguments: any[]): Timeout;
26
function clearTimeout(timeout: Timeout | undefined): void;
27
28
function setInterval(callback: (...args: any[]) => void, delay?: number, ...args: any[]): Timeout;
29
function clearInterval(timeout: Timeout | undefined): void;
30
31
32
// --- error
33
34
interface ErrorConstructor {
35
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
36
stackTraceLimit: number;
37
}
38
}
39
40
export { }
41
42