@dynatrace/runtime-simulator
Version:
The Dynatrace JavaScript runtime simulator.
134 lines (119 loc) • 3.41 kB
TypeScript
/// <reference no-default-lib="true" />
/// <reference lib="esnext" />
declare module 'runtime' {
global {
/**
* Returns the application ID
* @deprecated Use `@dynatrace/app-environment` instead. See https://dt-url.net/cu23aav
*/
var appId: string;
/**
* Returns the tenant ID
* @deprecated Use `@dynatrace/app-environment` instead. See https://dt-url.net/cu23aav
*/
var tenantId: string;
/**
* Returns the environment URL
* @deprecated Use `@dynatrace/app-environment` instead. See https://dt-url.net/cu23aav
*/
var environmentUrl: string;
/**
* The `Resumable` class is a primitive for building [resumable functions](https://dt-url.net/iv23pj3).
*
* Functions that return a `Resumable` are invoked by Dynatrace AppEngine again
* at a later time to allow for asynchronous operations running in the background.
*/
interface ResumableConstructor {
/**
* Resume an invocation of this function by returning a Resumable.
* @param payload Payload passed to the following invocation of the resumed function.
*/
new (payload?: any): Resumable;
}
interface Resumable {
payload: any;
}
var Resumable: ResumableConstructor;
}
}
declare interface VoidFunction {
(): void;
}
/** @category Web APIs */
declare interface Navigator {
readonly hardwareConcurrency: number;
readonly userAgent: string;
readonly language: string;
readonly languages: string[];
}
/** @category Web APIs */
declare var Navigator: {
readonly prototype: Navigator;
new (): never;
};
declare var navigator: Navigator;
declare var window: typeof globalThis;
declare var self: typeof globalThis;
declare var global: typeof globalThis;
/** Sets a timer which executes a function once after the delay (in milliseconds) elapses. Returns
* an id which may be used to cancel the timeout.
*
* ```ts
* setTimeout(() => { console.log('hello'); }, 500);
* ```
*
* @category Timers
*/
declare function setTimeout(
/** callback function to execute when timer expires */
cb: (...args: any[]) => void,
/** delay in ms */
delay?: number,
/** arguments passed to callback function */
...args: any[]
): number;
/** Repeatedly calls a function , with a fixed time delay between each call.
*
* ```ts
* // Outputs 'hello' to the console every 500ms
* setInterval(() => { console.log('hello'); }, 500);
* ```
*
* @category Timers
*/
declare function setInterval(
/** callback function to execute when timer expires */
cb: (...args: any[]) => void,
/** delay in ms */
delay?: number,
/** arguments passed to callback function */
...args: any[]
): number;
/** Cancels a timed, repeating action which was previously started by a call
* to `setInterval()`
*
* ```ts
* const id = setInterval(() => {console.log('hello');}, 500);
* // ...
* clearInterval(id);
* ```
*
* @category Timers
*/
declare function clearInterval(id?: number): void;
/** Cancels a scheduled action initiated by `setTimeout()`
*
* ```ts
* const id = setTimeout(() => {console.log('hello');}, 500);
* // ...
* clearTimeout(id);
* ```
*
* @category Timers
*/
declare function clearTimeout(id?: number): void;
/**
* Creates a deep clone of an object.
*/
declare function structuredClone<T>(value: T): T;
type BufferSource = ArrayBuffer | ArrayBufferView;