/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
///
/////////////////////////////
/// Worker APIs
/////////////////////////////
interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
passive?: boolean;
signal?: AbortSignal;
}
interface AesCbcParams extends Algorithm {
iv: BufferSource;
}
interface AesCtrParams extends Algorithm {
counter: BufferSource;
length: number;
}
interface AesDerivedKeyParams extends Algorithm {
length: number;
}
interface AesGcmParams extends Algorithm {
additionalData?: BufferSource;
iv: BufferSource;
tagLength?: number;
}
interface AesKeyAlgorithm extends KeyAlgorithm {
length: number;
}
interface AesKeyGenParams extends Algorithm {
length: number;
}
interface Algorithm {
name: string;
}
interface AudioConfiguration {
bitrate?: number;
channels?: string;
contentType: string;
samplerate?: number;
spatialRendering?: boolean;
}
interface BlobPropertyBag {
endings?: EndingType;
type?: string;
}
interface CacheQueryOptions {
ignoreMethod?: boolean;
ignoreSearch?: boolean;
ignoreVary?: boolean;
}
interface ClientQueryOptions {
includeUncontrolled?: boolean;
type?: ClientTypes;
}
interface CloseEventInit extends EventInit {
code?: number;
reason?: string;
wasClean?: boolean;
}
interface CryptoKeyPair {
privateKey?: CryptoKey;
publicKey?: CryptoKey;
}
interface CustomEventInit extends EventInit {
detail?: T;
}
interface DOMMatrix2DInit {
a?: number;
b?: number;
c?: number;
d?: number;
e?: number;
f?: number;
m11?: number;
m12?: number;
m21?: number;
m22?: number;
m41?: number;
m42?: number;
}
interface DOMMatrixInit extends DOMMatrix2DInit {
is2D?: boolean;
m13?: number;
m14?: number;
m23?: number;
m24?: number;
m31?: number;
m32?: number;
m33?: number;
m34?: number;
m43?: number;
m44?: number;
}
interface DOMPointInit {
w?: number;
x?: number;
y?: number;
z?: number;
}
interface DOMQuadInit {
p1?: DOMPointInit;
p2?: DOMPointInit;
p3?: DOMPointInit;
p4?: DOMPointInit;
}
interface DOMRectInit {
height?: number;
width?: number;
x?: number;
y?: number;
}
interface EcKeyGenParams extends Algorithm {
namedCurve: NamedCurve;
}
interface EcKeyImportParams extends Algorithm {
namedCurve: NamedCurve;
}
interface EcdhKeyDeriveParams extends Algorithm {
public: CryptoKey;
}
interface EcdsaParams extends Algorithm {
hash: HashAlgorithmIdentifier;
}
interface ErrorEventInit extends EventInit {
colno?: number;
error?: any;
filename?: string;
lineno?: number;
message?: string;
}
interface EventInit {
bubbles?: boolean;
cancelable?: boolean;
composed?: boolean;
}
interface EventListenerOptions {
capture?: boolean;
}
interface EventSourceInit {
withCredentials?: boolean;
}
interface ExtendableEventInit extends EventInit {
}
interface ExtendableMessageEventInit extends ExtendableEventInit {
data?: any;
lastEventId?: string;
origin?: string;
ports?: MessagePort[];
source?: Client | ServiceWorker | MessagePort | null;
}
interface FetchEventInit extends ExtendableEventInit {
clientId?: string;
handled?: Promise;
preloadResponse?: Promise;
replacesClientId?: string;
request: Request;
resultingClientId?: string;
}
interface FilePropertyBag extends BlobPropertyBag {
lastModified?: number;
}
interface FontFaceDescriptors {
display?: string;
featureSettings?: string;
stretch?: string;
style?: string;
unicodeRange?: string;
variant?: string;
weight?: string;
}
interface FontFaceSetLoadEventInit extends EventInit {
fontfaces?: FontFace[];
}
interface GetNotificationOptions {
tag?: string;
}
interface HkdfParams extends Algorithm {
hash: HashAlgorithmIdentifier;
info: BufferSource;
salt: BufferSource;
}
interface HmacImportParams extends Algorithm {
hash: HashAlgorithmIdentifier;
length?: number;
}
interface HmacKeyGenParams extends Algorithm {
hash: HashAlgorithmIdentifier;
length?: number;
}
interface IDBDatabaseInfo {
name?: string;
version?: number;
}
interface IDBIndexParameters {
multiEntry?: boolean;
unique?: boolean;
}
interface IDBObjectStoreParameters {
autoIncrement?: boolean;
keyPath?: string | string[] | null;
}
interface IDBVersionChangeEventInit extends EventInit {
newVersion?: number | null;
oldVersion?: number;
}
interface ImageBitmapOptions {
colorSpaceConversion?: ColorSpaceConversion;
imageOrientation?: ImageOrientation;
premultiplyAlpha?: PremultiplyAlpha;
resizeHeight?: number;
resizeQuality?: ResizeQuality;
resizeWidth?: number;
}
interface ImageBitmapRenderingContextSettings {
alpha?: boolean;
}
interface ImageDataSettings {
colorSpace?: PredefinedColorSpace;
}
interface ImportMeta {
url: string;
}
interface JsonWebKey {
alg?: string;
crv?: string;
d?: string;
dp?: string;
dq?: string;
e?: string;
ext?: boolean;
k?: string;
key_ops?: string[];
kty?: string;
n?: string;
oth?: RsaOtherPrimesInfo[];
p?: string;
q?: string;
qi?: string;
use?: string;
x?: string;
y?: string;
}
interface KeyAlgorithm {
name: string;
}
interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo {
configuration?: MediaDecodingConfiguration;
}
interface MediaCapabilitiesEncodingInfo extends MediaCapabilitiesInfo {
configuration?: MediaEncodingConfiguration;
}
interface MediaCapabilitiesInfo {
powerEfficient: boolean;
smooth: boolean;
supported: boolean;
}
interface MediaConfiguration {
audio?: AudioConfiguration;
video?: VideoConfiguration;
}
interface MediaDecodingConfiguration extends MediaConfiguration {
type: MediaDecodingType;
}
interface MediaEncodingConfiguration extends MediaConfiguration {
type: MediaEncodingType;
}
interface MessageEventInit extends EventInit {
data?: T;
lastEventId?: string;
origin?: string;
ports?: MessagePort[];
source?: MessageEventSource | null;
}
interface MultiCacheQueryOptions extends CacheQueryOptions {
cacheName?: string;
}
interface NotificationAction {
action: string;
icon?: string;
title: string;
}
interface NotificationEventInit extends ExtendableEventInit {
action?: string;
notification: Notification;
}
interface NotificationOptions {
actions?: NotificationAction[];
badge?: string;
body?: string;
data?: any;
dir?: NotificationDirection;
icon?: string;
image?: string;
lang?: string;
renotify?: boolean;
requireInteraction?: boolean;
silent?: boolean;
tag?: string;
timestamp?: DOMTimeStamp;
vibrate?: VibratePattern;
}
interface Pbkdf2Params extends Algorithm {
hash: HashAlgorithmIdentifier;
iterations: number;
salt: BufferSource;
}
interface PerformanceMarkOptions {
detail?: any;
startTime?: DOMHighResTimeStamp;
}
interface PerformanceMeasureOptions {
detail?: any;
duration?: DOMHighResTimeStamp;
end?: string | DOMHighResTimeStamp;
start?: string | DOMHighResTimeStamp;
}
interface PerformanceObserverInit {
buffered?: boolean;
entryTypes?: string[];
type?: string;
}
interface PermissionDescriptor {
name: PermissionName;
}
interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
total?: number;
}
interface PromiseRejectionEventInit extends EventInit {
promise: Promise;
reason?: any;
}
interface PushEventInit extends ExtendableEventInit {
data?: PushMessageDataInit;
}
interface PushSubscriptionJSON {
endpoint?: string;
expirationTime?: DOMTimeStamp | null;
keys?: Record;
}
interface PushSubscriptionOptionsInit {
applicationServerKey?: BufferSource | string | null;
userVisibleOnly?: boolean;
}
interface QueuingStrategy {
highWaterMark?: number;
size?: QueuingStrategySize;
}
interface QueuingStrategyInit {
/**
* Creates a new ByteLengthQueuingStrategy with the provided high water mark.
*
* Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
*/
highWaterMark: number;
}
interface ReadableStreamDefaultReadDoneResult {
done: true;
value?: undefined;
}
interface ReadableStreamDefaultReadValueResult {
done: false;
value: T;
}
interface ReadableWritablePair {
readable: ReadableStream;
/**
* Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*/
writable: WritableStream;
}
interface RegistrationOptions {
scope?: string;
type?: WorkerType;
updateViaCache?: ServiceWorkerUpdateViaCache;
}
interface RequestInit {
/** A BodyInit object or null to set request's body. */
body?: BodyInit | null;
/** A string indicating how the request will interact with the browser's cache to set request's cache. */
cache?: RequestCache;
/** A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. */
credentials?: RequestCredentials;
/** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */
headers?: HeadersInit;
/** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
integrity?: string;
/** A boolean to set request's keepalive. */
keepalive?: boolean;
/** A string to set request's method. */
method?: string;
/** A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. */
mode?: RequestMode;
/** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */
redirect?: RequestRedirect;
/** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */
referrer?: string;
/** A referrer policy to set request's referrerPolicy. */
referrerPolicy?: ReferrerPolicy;
/** An AbortSignal to set request's signal. */
signal?: AbortSignal | null;
/** Can only be null. Used to disassociate request from any Window. */
window?: null;
}
interface ResponseInit {
headers?: HeadersInit;
status?: number;
statusText?: string;
}
interface RsaHashedImportParams extends Algorithm {
hash: HashAlgorithmIdentifier;
}
interface RsaHashedKeyGenParams extends RsaKeyGenParams {
hash: HashAlgorithmIdentifier;
}
interface RsaKeyGenParams extends Algorithm {
modulusLength: number;
publicExponent: BigInteger;
}
interface RsaOaepParams extends Algorithm {
label?: BufferSource;
}
interface RsaOtherPrimesInfo {
d?: string;
r?: string;
t?: string;
}
interface RsaPssParams extends Algorithm {
saltLength: number;
}
interface SecurityPolicyViolationEventInit extends EventInit {
blockedURI?: string;
columnNumber?: number;
disposition: SecurityPolicyViolationEventDisposition;
documentURI: string;
effectiveDirective: string;
lineNumber?: number;
originalPolicy: string;
referrer?: string;
sample?: string;
sourceFile?: string;
statusCode: number;
violatedDirective: string;
}
interface StorageEstimate {
quota?: number;
usage?: number;
}
interface StreamPipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
/**
* Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
*
* Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
*
* Errors and closures of the source and destination streams propagate as follows:
*
* An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
*
* An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
*
* When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
*
* If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
*
* The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
*/
preventClose?: boolean;
signal?: AbortSignal;
}
interface StructuredSerializeOptions {
transfer?: any[];
}
interface TextDecodeOptions {
stream?: boolean;
}
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
interface TextEncoderEncodeIntoResult {
read?: number;
written?: number;
}
interface Transformer {
flush?: TransformerFlushCallback;
readableType?: undefined;
start?: TransformerStartCallback;
transform?: TransformerTransformCallback;
writableType?: undefined;
}
interface UnderlyingSink {
abort?: UnderlyingSinkAbortCallback;
close?: UnderlyingSinkCloseCallback;
start?: UnderlyingSinkStartCallback;
type?: undefined;
write?: UnderlyingSinkWriteCallback;
}
interface UnderlyingSource {
cancel?: UnderlyingSourceCancelCallback;
pull?: UnderlyingSourcePullCallback;
start?: UnderlyingSourceStartCallback;
type?: undefined;
}
interface VideoConfiguration {
bitrate: number;
colorGamut?: ColorGamut;
contentType: string;
framerate: number;
hdrMetadataType?: HdrMetadataType;
height: number;
scalabilityMode?: string;
transferFunction?: TransferFunction;
width: number;
}
interface WebGLContextAttributes {
alpha?: boolean;
antialias?: boolean;
depth?: boolean;
desynchronized?: boolean;
failIfMajorPerformanceCaveat?: boolean;
powerPreference?: WebGLPowerPreference;
premultipliedAlpha?: boolean;
preserveDrawingBuffer?: boolean;
stencil?: boolean;
}
interface WebGLContextEventInit extends EventInit {
statusMessage?: string;
}
interface WorkerOptions {
credentials?: RequestCredentials;
name?: string;
type?: WorkerType;
}
/** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */
interface ANGLE_instanced_arrays {
drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void;
drawElementsInstancedANGLE(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, primcount: GLsizei): void;
vertexAttribDivisorANGLE(index: GLuint, divisor: GLuint): void;
readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum;
}
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/** Returns the AbortSignal object associated with this object. */
readonly signal: AbortSignal;
/** Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. */
abort(): void;
}
declare var AbortController: {
prototype: AbortController;
new(): AbortController;
};
interface AbortSignalEventMap {
"abort": Event;
}
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
interface AbortSignal extends EventTarget {
/** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */
readonly aborted: boolean;
onabort: ((this: AbortSignal, ev: Event) => any) | null;
addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var AbortSignal: {
prototype: AbortSignal;
new(): AbortSignal;
// abort(): AbortSignal; - To be re-added in the future
};
interface AbstractWorkerEventMap {
"error": ErrorEvent;
}
interface AbstractWorker {
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
interface AnimationFrameProvider {
cancelAnimationFrame(handle: number): void;
requestAnimationFrame(callback: FrameRequestCallback): number;
}
/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
interface Blob {
readonly size: number;
readonly type: string;
arrayBuffer(): Promise;
slice(start?: number, end?: number, contentType?: string): Blob;
stream(): ReadableStream;
text(): Promise;
}
declare var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
};
interface Body {
readonly body: ReadableStream | null;
readonly bodyUsed: boolean;
arrayBuffer(): Promise;
blob(): Promise;
formData(): Promise;
json(): Promise;
text(): Promise;
}
interface BroadcastChannelEventMap {
"message": MessageEvent;
"messageerror": MessageEvent;
}
interface BroadcastChannel extends EventTarget {
/** Returns the channel name (as passed to the constructor). */
readonly name: string;
onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null;
onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null;
/** Closes the BroadcastChannel object, opening it up to garbage collection. */
close(): void;
/** Sends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays. */
postMessage(message: any): void;
addEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var BroadcastChannel: {
prototype: BroadcastChannel;
new(name: string): BroadcastChannel;
};
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface ByteLengthQueuingStrategy extends QueuingStrategy {
readonly highWaterMark: number;
readonly size: QueuingStrategySize;
}
declare var ByteLengthQueuingStrategy: {
prototype: ByteLengthQueuingStrategy;
new(init: QueuingStrategyInit): ByteLengthQueuingStrategy;
};
/**
* Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec.
* Available only in secure contexts.
*/
interface Cache {
add(request: RequestInfo): Promise;
addAll(requests: RequestInfo[]): Promise;
delete(request: RequestInfo, options?: CacheQueryOptions): Promise;
keys(request?: RequestInfo, options?: CacheQueryOptions): Promise>;
match(request: RequestInfo, options?: CacheQueryOptions): Promise;
matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise>;
put(request: RequestInfo, response: Response): Promise;
}
declare var Cache: {
prototype: Cache;
new(): Cache;
};
/**
* The storage for Cache objects.
* Available only in secure contexts.
*/
interface CacheStorage {
delete(cacheName: string): Promise;
has(cacheName: string): Promise;
keys(): Promise;
match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise;
open(cacheName: string): Promise;
}
declare var CacheStorage: {
prototype: CacheStorage;
new(): CacheStorage;
};
/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */
interface CanvasGradient {
/**
* Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.
*
* Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed.
*/
addColorStop(offset: number, color: string): void;
}
declare var CanvasGradient: {
prototype: CanvasGradient;
new(): CanvasGradient;
};
interface CanvasPath {
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
closePath(): void;
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;
lineTo(x: number, y: number): void;
moveTo(x: number, y: number): void;
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;
rect(x: number, y: number, w: number, h: number): void;
}
/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */
interface CanvasPattern {
/** Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. */
setTransform(transform?: DOMMatrix2DInit): void;
}
declare var CanvasPattern: {
prototype: CanvasPattern;
new(): CanvasPattern;
};
/** The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient. You can get Client/WindowClient objects from methods such as Clients.matchAll() and Clients.get(). */
interface Client {
readonly frameType: FrameType;
readonly id: string;
readonly type: ClientTypes;
readonly url: string;
postMessage(message: any, transfer: Transferable[]): void;
postMessage(message: any, options?: StructuredSerializeOptions): void;
}
declare var Client: {
prototype: Client;
new(): Client;
};
/** Provides access to Client objects. Access it via self.clients within a service worker. */
interface Clients {
claim(): Promise;
get(id: string): Promise;
matchAll(options?: T): Promise>;
openWindow(url: string | URL): Promise;
}
declare var Clients: {
prototype: Clients;
new(): Clients;
};
/** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */
interface CloseEvent extends Event {
/** Returns the WebSocket connection close code provided by the server. */
readonly code: number;
/** Returns the WebSocket connection close reason provided by the server. */
readonly reason: string;
/** Returns true if the connection closed cleanly; false otherwise. */
readonly wasClean: boolean;
}
declare var CloseEvent: {
prototype: CloseEvent;
new(type: string, eventInitDict?: CloseEventInit): CloseEvent;
};
/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface CountQueuingStrategy extends QueuingStrategy {
readonly highWaterMark: number;
readonly size: QueuingStrategySize;
}
declare var CountQueuingStrategy: {
prototype: CountQueuingStrategy;
new(init: QueuingStrategyInit): CountQueuingStrategy;
};
/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
interface Crypto {
/** Available only in secure contexts. */
readonly subtle: SubtleCrypto;
getRandomValues(array: T): T;
}
declare var Crypto: {
prototype: Crypto;
new(): Crypto;
};
/**
* The CryptoKey dictionary of the Web Crypto API represents a cryptographic key.
* Available only in secure contexts.
*/
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
readonly type: KeyType;
readonly usages: KeyUsage[];
}
declare var CryptoKey: {
prototype: CryptoKey;
new(): CryptoKey;
};
interface CustomEvent extends Event {
/** Returns any custom data event was created with. Typically used for synthetic events. */
readonly detail: T;
/** @deprecated */
initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void;
}
declare var CustomEvent: {
prototype: CustomEvent;
new(type: string, eventInitDict?: CustomEventInit): CustomEvent;
};
/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
interface DOMException extends Error {
readonly code: number;
readonly message: string;
readonly name: string;
readonly ABORT_ERR: number;
readonly DATA_CLONE_ERR: number;
readonly DOMSTRING_SIZE_ERR: number;
readonly HIERARCHY_REQUEST_ERR: number;
readonly INDEX_SIZE_ERR: number;
readonly INUSE_ATTRIBUTE_ERR: number;
readonly INVALID_ACCESS_ERR: number;
readonly INVALID_CHARACTER_ERR: number;
readonly INVALID_MODIFICATION_ERR: number;
readonly INVALID_NODE_TYPE_ERR: number;
readonly INVALID_STATE_ERR: number;
readonly NAMESPACE_ERR: number;
readonly NETWORK_ERR: number;
readonly NOT_FOUND_ERR: number;
readonly NOT_SUPPORTED_ERR: number;
readonly NO_DATA_ALLOWED_ERR: number;
readonly NO_MODIFICATION_ALLOWED_ERR: number;
readonly QUOTA_EXCEEDED_ERR: number;
readonly SECURITY_ERR: number;
readonly SYNTAX_ERR: number;
readonly TIMEOUT_ERR: number;
readonly TYPE_MISMATCH_ERR: number;
readonly URL_MISMATCH_ERR: number;
readonly VALIDATION_ERR: number;
readonly WRONG_DOCUMENT_ERR: number;
}
declare var DOMException: {
prototype: DOMException;
new(message?: string, name?: string): DOMException;
readonly ABORT_ERR: number;
readonly DATA_CLONE_ERR: number;
readonly DOMSTRING_SIZE_ERR: number;
readonly HIERARCHY_REQUEST_ERR: number;
readonly INDEX_SIZE_ERR: number;
readonly INUSE_ATTRIBUTE_ERR: number;
readonly INVALID_ACCESS_ERR: number;
readonly INVALID_CHARACTER_ERR: number;
readonly INVALID_MODIFICATION_ERR: number;
readonly INVALID_NODE_TYPE_ERR: number;
readonly INVALID_STATE_ERR: number;
readonly NAMESPACE_ERR: number;
readonly NETWORK_ERR: number;
readonly NOT_FOUND_ERR: number;
readonly NOT_SUPPORTED_ERR: number;
readonly NO_DATA_ALLOWED_ERR: number;
readonly NO_MODIFICATION_ALLOWED_ERR: number;
readonly QUOTA_EXCEEDED_ERR: number;
readonly SECURITY_ERR: number;
readonly SYNTAX_ERR: number;
readonly TIMEOUT_ERR: number;
readonly TYPE_MISMATCH_ERR: number;
readonly URL_MISMATCH_ERR: number;
readonly VALIDATION_ERR: number;
readonly WRONG_DOCUMENT_ERR: number;
};
interface DOMMatrix extends DOMMatrixReadOnly {
a: number;
b: number;
c: number;
d: number;
e: number;
f: number;
m11: number;
m12: number;
m13: number;
m14: number;
m21: number;
m22: number;
m23: number;
m24: number;
m31: number;
m32: number;
m33: number;
m34: number;
m41: number;
m42: number;
m43: number;
m44: number;
invertSelf(): DOMMatrix;
multiplySelf(other?: DOMMatrixInit): DOMMatrix;
preMultiplySelf(other?: DOMMatrixInit): DOMMatrix;
rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
rotateFromVectorSelf(x?: number, y?: number): DOMMatrix;
rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
skewXSelf(sx?: number): DOMMatrix;
skewYSelf(sy?: number): DOMMatrix;
translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix;
}
declare var DOMMatrix: {
prototype: DOMMatrix;
new(init?: string | number[]): DOMMatrix;
fromFloat32Array(array32: Float32Array): DOMMatrix;
fromFloat64Array(array64: Float64Array): DOMMatrix;
fromMatrix(other?: DOMMatrixInit): DOMMatrix;
};
interface DOMMatrixReadOnly {
readonly a: number;
readonly b: number;
readonly c: number;
readonly d: number;
readonly e: number;
readonly f: number;
readonly is2D: boolean;
readonly isIdentity: boolean;
readonly m11: number;
readonly m12: number;
readonly m13: number;
readonly m14: number;
readonly m21: number;
readonly m22: number;
readonly m23: number;
readonly m24: number;
readonly m31: number;
readonly m32: number;
readonly m33: number;
readonly m34: number;
readonly m41: number;
readonly m42: number;
readonly m43: number;
readonly m44: number;
flipX(): DOMMatrix;
flipY(): DOMMatrix;
inverse(): DOMMatrix;
multiply(other?: DOMMatrixInit): DOMMatrix;
rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix;
rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix;
rotateFromVector(x?: number, y?: number): DOMMatrix;
scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix;
/** @deprecated */
scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix;
skewX(sx?: number): DOMMatrix;
skewY(sy?: number): DOMMatrix;
toFloat32Array(): Float32Array;
toFloat64Array(): Float64Array;
toJSON(): any;
transformPoint(point?: DOMPointInit): DOMPoint;
translate(tx?: number, ty?: number, tz?: number): DOMMatrix;
}
declare var DOMMatrixReadOnly: {
prototype: DOMMatrixReadOnly;
new(init?: string | number[]): DOMMatrixReadOnly;
fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly;
fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly;
fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly;
};
interface DOMPoint extends DOMPointReadOnly {
w: number;
x: number;
y: number;
z: number;
}
declare var DOMPoint: {
prototype: DOMPoint;
new(x?: number, y?: number, z?: number, w?: number): DOMPoint;
fromPoint(other?: DOMPointInit): DOMPoint;
};
interface DOMPointReadOnly {
readonly w: number;
readonly x: number;
readonly y: number;
readonly z: number;
matrixTransform(matrix?: DOMMatrixInit): DOMPoint;
toJSON(): any;
}
declare var DOMPointReadOnly: {
prototype: DOMPointReadOnly;
new(x?: number, y?: number, z?: number, w?: number): DOMPointReadOnly;
fromPoint(other?: DOMPointInit): DOMPointReadOnly;
};
interface DOMQuad {
readonly p1: DOMPoint;
readonly p2: DOMPoint;
readonly p3: DOMPoint;
readonly p4: DOMPoint;
getBounds(): DOMRect;
toJSON(): any;
}
declare var DOMQuad: {
prototype: DOMQuad;
new(p1?: DOMPointInit, p2?: DOMPointInit, p3?: DOMPointInit, p4?: DOMPointInit): DOMQuad;
fromQuad(other?: DOMQuadInit): DOMQuad;
fromRect(other?: DOMRectInit): DOMQuad;
};
interface DOMRect extends DOMRectReadOnly {
height: number;
width: number;
x: number;
y: number;
}
declare var DOMRect: {
prototype: DOMRect;
new(x?: number, y?: number, width?: number, height?: number): DOMRect;
fromRect(other?: DOMRectInit): DOMRect;
};
interface DOMRectReadOnly {
readonly bottom: number;
readonly height: number;
readonly left: number;
readonly right: number;
readonly top: number;
readonly width: number;
readonly x: number;
readonly y: number;
toJSON(): any;
}
declare var DOMRectReadOnly: {
prototype: DOMRectReadOnly;
new(x?: number, y?: number, width?: number, height?: number): DOMRectReadOnly;
fromRect(other?: DOMRectInit): DOMRectReadOnly;
};
/** A type returned by some APIs which contains a list of DOMString (strings). */
interface DOMStringList {
/** Returns the number of strings in strings. */
readonly length: number;
/** Returns true if strings contains string, and false otherwise. */
contains(string: string): boolean;
/** Returns the string with index index from strings. */
item(index: number): string | null;
[index: number]: string;
}
declare var DOMStringList: {
prototype: DOMStringList;
new(): DOMStringList;
};
interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap {
"message": MessageEvent;
"messageerror": MessageEvent;
}
/** (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers. */
interface DedicatedWorkerGlobalScope extends WorkerGlobalScope, AnimationFrameProvider {
/** Returns dedicatedWorkerGlobal's name, i.e. the value given to the Worker constructor. Primarily useful for debugging. */
readonly name: string;
onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null;
onmessageerror: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null;
/** Aborts dedicatedWorkerGlobal. */
close(): void;
/** Clones message and transmits it to the Worker object associated with dedicatedWorkerGlobal. transfer can be passed as a list of objects that are to be transferred rather than cloned. */
postMessage(message: any, transfer: Transferable[]): void;
postMessage(message: any, options?: StructuredSerializeOptions): void;
addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var DedicatedWorkerGlobalScope: {
prototype: DedicatedWorkerGlobalScope;
new(): DedicatedWorkerGlobalScope;
};
interface EXT_blend_minmax {
readonly MAX_EXT: GLenum;
readonly MIN_EXT: GLenum;
}
interface EXT_color_buffer_float {
}
interface EXT_color_buffer_half_float {
readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: GLenum;
readonly RGB16F_EXT: GLenum;
readonly RGBA16F_EXT: GLenum;
readonly UNSIGNED_NORMALIZED_EXT: GLenum;
}
interface EXT_float_blend {
}
/** The EXT_frag_depth extension is part of the WebGL API and enables to set a depth value of a fragment from within the fragment shader. */
interface EXT_frag_depth {
}
interface EXT_sRGB {
readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: GLenum;
readonly SRGB8_ALPHA8_EXT: GLenum;
readonly SRGB_ALPHA_EXT: GLenum;
readonly SRGB_EXT: GLenum;
}
interface EXT_shader_texture_lod {
}
interface EXT_texture_compression_rgtc {
readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum;
readonly COMPRESSED_RED_RGTC1_EXT: GLenum;
readonly COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: GLenum;
readonly COMPRESSED_SIGNED_RED_RGTC1_EXT: GLenum;
}
/** The EXT_texture_filter_anisotropic extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF). */
interface EXT_texture_filter_anisotropic {
readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: GLenum;
readonly TEXTURE_MAX_ANISOTROPY_EXT: GLenum;
}
/** Events providing information related to errors in scripts or in files. */
interface ErrorEvent extends Event {
readonly colno: number;
readonly error: any;
readonly filename: string;
readonly lineno: number;
readonly message: string;
}
declare var ErrorEvent: {
prototype: ErrorEvent;
new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
};
/** An event which takes place in the DOM. */
interface Event {
/** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */
readonly bubbles: boolean;
cancelBubble: boolean;
/** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */
readonly cancelable: boolean;
/** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */
readonly composed: boolean;
/** Returns the object whose event listener's callback is currently being invoked. */
readonly currentTarget: EventTarget | null;
/** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */
readonly defaultPrevented: boolean;
/** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */
readonly eventPhase: number;
/** Returns true if event was dispatched by the user agent, and false otherwise. */
readonly isTrusted: boolean;
/** @deprecated */
returnValue: boolean;
/** @deprecated */
readonly srcElement: EventTarget | null;
/** Returns the object to which event is dispatched (its target). */
readonly target: EventTarget | null;
/** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */
readonly timeStamp: DOMHighResTimeStamp;
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
readonly type: string;
/** Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. */
composedPath(): EventTarget[];
/** @deprecated */
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
/** If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. */
preventDefault(): void;
/** Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. */
stopImmediatePropagation(): void;
/** When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. */
stopPropagation(): void;
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
readonly NONE: number;
}
declare var Event: {
prototype: Event;
new(type: string, eventInitDict?: EventInit): Event;
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
readonly NONE: number;
};
interface EventListener {
(evt: Event): void;
}
interface EventListenerObject {
handleEvent(object: Event): void;
}
interface EventSourceEventMap {
"error": Event;
"message": MessageEvent;
"open": Event;
}
interface EventSource extends EventTarget {
onerror: ((this: EventSource, ev: Event) => any) | null;
onmessage: ((this: EventSource, ev: MessageEvent) => any) | null;
onopen: ((this: EventSource, ev: Event) => any) | null;
/** Returns the state of this EventSource object's connection. It can have the values described below. */
readonly readyState: number;
/** Returns the URL providing the event stream. */
readonly url: string;
/** Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. */
readonly withCredentials: boolean;
/** Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. */
close(): void;
readonly CLOSED: number;
readonly CONNECTING: number;
readonly OPEN: number;
addEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var EventSource: {
prototype: EventSource;
new(url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource;
readonly CLOSED: number;
readonly CONNECTING: number;
readonly OPEN: number;
};
/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */
interface EventTarget {
/**
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
*
* The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
*
* When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
*
* When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
*
* When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
*
* If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
*
* The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
*/
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
dispatchEvent(event: Event): boolean;
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
}
declare var EventTarget: {
prototype: EventTarget;
new(): EventTarget;
};
/** Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. */
interface ExtendableEvent extends Event {
waitUntil(f: any): void;
}
declare var ExtendableEvent: {
prototype: ExtendableEvent;
new(type: string, eventInitDict?: ExtendableEventInit): ExtendableEvent;
};
/** This ServiceWorker API interface represents the event object of a message event fired on a service worker (when a channel message is received on the ServiceWorkerGlobalScope from another context) — extends the lifetime of such events. */
interface ExtendableMessageEvent extends ExtendableEvent {
readonly data: any;
readonly lastEventId: string;
readonly origin: string;
readonly ports: ReadonlyArray;
readonly source: Client | ServiceWorker | MessagePort | null;
}
declare var ExtendableMessageEvent: {
prototype: ExtendableMessageEvent;
new(type: string, eventInitDict?: ExtendableMessageEventInit): ExtendableMessageEvent;
};
/** This is the event type for fetch events dispatched on the service worker global scope. It contains information about the fetch, including the request and how the receiver will treat the response. It provides the event.respondWith() method, which allows us to provide a response to this fetch. */
interface FetchEvent extends ExtendableEvent {
readonly clientId: string;
readonly handled: Promise;
readonly request: Request;
readonly resultingClientId: string;
respondWith(r: Response | PromiseLike): void;
}
declare var FetchEvent: {
prototype: FetchEvent;
new(type: string, eventInitDict: FetchEventInit): FetchEvent;
};
/** Provides information about files and allows JavaScript in a web page to access their content. */
interface File extends Blob {
readonly lastModified: number;
readonly name: string;
readonly webkitRelativePath: string;
}
declare var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
};
/** An object of this type is returned by the files property of the HTML element; this lets you access the list of files selected with the element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. */
interface FileList {
readonly length: number;
item(index: number): File | null;
[index: number]: File;
}
declare var FileList: {
prototype: FileList;
new(): FileList;
};
interface FileReaderEventMap {
"abort": ProgressEvent;
"error": ProgressEvent;
"load": ProgressEvent;
"loadend": ProgressEvent;
"loadstart": ProgressEvent;
"progress": ProgressEvent;
}
/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */
interface FileReader extends EventTarget {
readonly error: DOMException | null;
onabort: ((this: FileReader, ev: ProgressEvent) => any) | null;
onerror: ((this: FileReader, ev: ProgressEvent) => any) | null;
onload: ((this: FileReader, ev: ProgressEvent) => any) | null;
onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null;
onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null;
onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null;
readonly readyState: number;
readonly result: string | ArrayBuffer | null;
abort(): void;
readAsArrayBuffer(blob: Blob): void;
readAsBinaryString(blob: Blob): void;
readAsDataURL(blob: Blob): void;
readAsText(blob: Blob, encoding?: string): void;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
addEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var FileReader: {
prototype: FileReader;
new(): FileReader;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
};
/** Allows to read File or Blob objects in a synchronous way. */
interface FileReaderSync {
readAsArrayBuffer(blob: Blob): ArrayBuffer;
/** @deprecated */
readAsBinaryString(blob: Blob): string;
readAsDataURL(blob: Blob): string;
readAsText(blob: Blob, encoding?: string): string;
}
declare var FileReaderSync: {
prototype: FileReaderSync;
new(): FileReaderSync;
};
interface FontFace {
ascentOverride: string;
descentOverride: string;
display: string;
family: string;
featureSettings: string;
lineGapOverride: string;
readonly loaded: Promise;
readonly status: FontFaceLoadStatus;
stretch: string;
style: string;
unicodeRange: string;
variant: string;
variationSettings: string;
weight: string;
load(): Promise;
}
declare var FontFace: {
prototype: FontFace;
new(family: string, source: string | BinaryData, descriptors?: FontFaceDescriptors): FontFace;
};
interface FontFaceSetEventMap {
"loading": Event;
"loadingdone": Event;
"loadingerror": Event;
}
interface FontFaceSet extends EventTarget {
onloading: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingdone: ((this: FontFaceSet, ev: Event) => any) | null;
onloadingerror: ((this: FontFaceSet, ev: Event) => any) | null;
readonly ready: Promise;
readonly status: FontFaceSetLoadStatus;
check(font: string, text?: string): boolean;
load(font: string, text?: string): Promise;
forEach(callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void, thisArg?: any): void;
addEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var FontFaceSet: {
prototype: FontFaceSet;
new(initialFaces: FontFace[]): FontFaceSet;
};
interface FontFaceSetLoadEvent extends Event {
readonly fontfaces: ReadonlyArray;
}
declare var FontFaceSetLoadEvent: {
prototype: FontFaceSetLoadEvent;
new(type: string, eventInitDict?: FontFaceSetLoadEventInit): FontFaceSetLoadEvent;
};
interface FontFaceSource {
readonly fonts: FontFaceSet;
}
/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
interface FormData {
append(name: string, value: string | Blob, fileName?: string): void;
delete(name: string): void;
get(name: string): FormDataEntryValue | null;
getAll(name: string): FormDataEntryValue[];
has(name: string): boolean;
set(name: string, value: string | Blob, fileName?: string): void;
forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
}
declare var FormData: {
prototype: FormData;
new(): FormData;
};
interface GenericTransformStream {
readonly readable: ReadableStream;
readonly writable: WritableStream;
}
/** This Fetch API interface allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
interface Headers {
append(name: string, value: string): void;
delete(name: string): void;
get(name: string): string | null;
has(name: string): boolean;
set(name: string, value: string): void;
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
}
declare var Headers: {
prototype: Headers;
new(init?: HeadersInit): Headers;
};
/** This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. */
interface IDBCursor {
/** Returns the direction ("next", "nextunique", "prev" or "prevunique") of the cursor. */
readonly direction: IDBCursorDirection;
/** Returns the key of the cursor. Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished. */
readonly key: IDBValidKey;
/** Returns the effective key of the cursor. Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished. */
readonly primaryKey: IDBValidKey;
readonly request: IDBRequest;
/** Returns the IDBObjectStore or IDBIndex the cursor was opened from. */
readonly source: IDBObjectStore | IDBIndex;
/** Advances the cursor through the next count records in range. */
advance(count: number): void;
/** Advances the cursor to the next record in range. */
continue(key?: IDBValidKey): void;
/** Advances the cursor to the next record in range matching or after key and primaryKey. Throws an "InvalidAccessError" DOMException if the source is not an index. */
continuePrimaryKey(key: IDBValidKey, primaryKey: IDBValidKey): void;
/**
* Delete the record pointed at by the cursor with a new value.
*
* If successful, request's result will be undefined.
*/
delete(): IDBRequest;
/**
* Updated the record pointed at by the cursor with a new value.
*
* Throws a "DataError" DOMException if the effective object store uses in-line keys and the key would have changed.
*
* If successful, request's result will be the record's key.
*/
update(value: any): IDBRequest;
}
declare var IDBCursor: {
prototype: IDBCursor;
new(): IDBCursor;
};
/** This IndexedDB API interface represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. */
interface IDBCursorWithValue extends IDBCursor {
/** Returns the cursor's current value. */
readonly value: any;
}
declare var IDBCursorWithValue: {
prototype: IDBCursorWithValue;
new(): IDBCursorWithValue;
};
interface IDBDatabaseEventMap {
"abort": Event;
"close": Event;
"error": Event;
"versionchange": IDBVersionChangeEvent;
}
/** This IndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. */
interface IDBDatabase extends EventTarget {
/** Returns the name of the database. */
readonly name: string;
/** Returns a list of the names of object stores in the database. */
readonly objectStoreNames: DOMStringList;
onabort: ((this: IDBDatabase, ev: Event) => any) | null;
onclose: ((this: IDBDatabase, ev: Event) => any) | null;
onerror: ((this: IDBDatabase, ev: Event) => any) | null;
onversionchange: ((this: IDBDatabase, ev: IDBVersionChangeEvent) => any) | null;
/** Returns the version of the database. */
readonly version: number;
/** Closes the connection once all running transactions have finished. */
close(): void;
/**
* Creates a new object store with the given name and options and returns a new IDBObjectStore.
*
* Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
*/
createObjectStore(name: string, options?: IDBObjectStoreParameters): IDBObjectStore;
/**
* Deletes the object store with the given name.
*
* Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
*/
deleteObjectStore(name: string): void;
/** Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names. */
transaction(storeNames: string | string[], mode?: IDBTransactionMode): IDBTransaction;
addEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var IDBDatabase: {
prototype: IDBDatabase;
new(): IDBDatabase;
};
/** In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.) */
interface IDBFactory {
/**
* Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.
*
* Throws a "DataError" DOMException if either input is not a valid key.
*/
cmp(first: any, second: any): number;
databases(): Promise;
/** Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null. */
deleteDatabase(name: string): IDBOpenDBRequest;
/** Attempts to open a connection to the named database with the current version, or 1 if it does not already exist. If the request is successful request's result will be the connection. */
open(name: string, version?: number): IDBOpenDBRequest;
}
declare var IDBFactory: {
prototype: IDBFactory;
new(): IDBFactory;
};
/** IDBIndex interface of the IndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data. */
interface IDBIndex {
readonly keyPath: string | string[];
readonly multiEntry: boolean;
/** Returns the name of the index. */
name: string;
/** Returns the IDBObjectStore the index belongs to. */
readonly objectStore: IDBObjectStore;
readonly unique: boolean;
/**
* Retrieves the number of records matching the given key or key range in query.
*
* If successful, request's result will be the count.
*/
count(query?: IDBValidKey | IDBKeyRange): IDBRequest;
/**
* Retrieves the value of the first record matching the given key or key range in query.
*
* If successful, request's result will be the value, or undefined if there was no matching record.
*/
get(query: IDBValidKey | IDBKeyRange): IDBRequest;
/**
* Retrieves the values of the records matching the given key or key range in query (up to count if given).
*
* If successful, request's result will be an Array of the values.
*/
getAll(query?: IDBValidKey | IDBKeyRange | null, count?: number): IDBRequest;
/**
* Retrieves the keys of records matching the given key or key range in query (up to count if given).
*
* If successful, request's result will be an Array of the keys.
*/
getAllKeys(query?: IDBValidKey | IDBKeyRange | null, count?: number): IDBRequest;
/**
* Retrieves the key of the first record matching the given key or key range in query.
*
* If successful, request's result will be the key, or undefined if there was no matching record.
*/
getKey(query: IDBValidKey | IDBKeyRange): IDBRequest;
/**
* Opens a cursor over the records matching query, ordered by direction. If query is null, all records in index are matched.
*
* If successful, request's result will be an IDBCursorWithValue, or null if there were no matching records.
*/
openCursor(query?: IDBValidKey | IDBKeyRange | null, direction?: IDBCursorDirection): IDBRequest;
/**
* Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in index are matched.
*
* If successful, request's result will be an IDBCursor, or null if there were no matching records.
*/
openKeyCursor(query?: IDBValidKey | IDBKeyRange | null, direction?: IDBCursorDirection): IDBRequest;
}
declare var IDBIndex: {
prototype: IDBIndex;
new(): IDBIndex;
};
/** A key range can be a single value or a range with upper and lower bounds or endpoints. If the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. A bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). To retrieve all keys within a certain range, you can use the following code constructs: */
interface IDBKeyRange {
/** Returns lower bound, or undefined if none. */
readonly lower: any;
/** Returns true if the lower open flag is set, and false otherwise. */
readonly lowerOpen: boolean;
/** Returns upper bound, or undefined if none. */
readonly upper: any;
/** Returns true if the upper open flag is set, and false otherwise. */
readonly upperOpen: boolean;
/** Returns true if key is included in the range, and false otherwise. */
includes(key: any): boolean;
}
declare var IDBKeyRange: {
prototype: IDBKeyRange;
new(): IDBKeyRange;
/** Returns a new IDBKeyRange spanning from lower to upper. If lowerOpen is true, lower is not included in the range. If upperOpen is true, upper is not included in the range. */
bound(lower: any, upper: any, lowerOpen?: boolean, upperOpen?: boolean): IDBKeyRange;
/** Returns a new IDBKeyRange starting at key with no upper bound. If open is true, key is not included in the range. */
lowerBound(lower: any, open?: boolean): IDBKeyRange;
/** Returns a new IDBKeyRange spanning only key. */
only(value: any): IDBKeyRange;
/** Returns a new IDBKeyRange with no lower bound and ending at key. If open is true, key is not included in the range. */
upperBound(upper: any, open?: boolean): IDBKeyRange;
};
/** This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.) */
interface IDBObjectStore {
/** Returns true if the store has a key generator, and false otherwise. */
readonly autoIncrement: boolean;
/** Returns a list of the names of indexes in the store. */
readonly indexNames: DOMStringList;
/** Returns the key path of the store, or null if none. */
readonly keyPath: string | string[];
/** Returns the name of the store. */
name: string;
/** Returns the associated transaction. */
readonly transaction: IDBTransaction;
/**
* Adds or updates a record in store with the given value and key.
*
* If the store uses in-line keys and key is specified a "DataError" DOMException will be thrown.
*
* If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a "ConstraintError" DOMException.
*
* If successful, request's result will be the record's key.
*/
add(value: any, key?: IDBValidKey): IDBRequest;
/**
* Deletes all records in store.
*
* If successful, request's result will be undefined.
*/
clear(): IDBRequest;
/**
* Retrieves the number of records matching the given key or key range in query.
*
* If successful, request's result will be the count.
*/
count(query?: IDBValidKey | IDBKeyRange): IDBRequest;
/**
* Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
*
* Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
*/
createIndex(name: string, keyPath: string | string[], options?: IDBIndexParameters): IDBIndex;
/**
* Deletes records in store with the given key or in the given key range in query.
*
* If successful, request's result will be undefined.
*/
delete(query: IDBValidKey | IDBKeyRange): IDBRequest;
/**
* Deletes the index in store with the given name.
*
* Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
*/
deleteIndex(name: string): void;
/**
* Retrieves the value of the first record matching the given key or key range in query.
*
* If successful, request's result will be the value, or undefined if there was no matching record.
*/
get(query: IDBValidKey | IDBKeyRange): IDBRequest;
/**
* Retrieves the values of the records matching the given key or key range in query (up to count if given).
*
* If successful, request's result will be an Array of the values.
*/
getAll(query?: IDBValidKey | IDBKeyRange | null, count?: number): IDBRequest;
/**
* Retrieves the keys of records matching the given key or key range in query (up to count if given).
*
* If successful, request's result will be an Array of the keys.
*/
getAllKeys(query?: IDBValidKey | IDBKeyRange | null, count?: number): IDBRequest;
/**
* Retrieves the key of the first record matching the given key or key range in query.
*
* If successful, request's result will be the key, or undefined if there was no matching record.
*/
getKey(query: IDBValidKey | IDBKeyRange): IDBRequest;
index(name: string): IDBIndex;
/**
* Opens a cursor over the records matching query, ordered by direction. If query is null, all records in store are matched.
*
* If successful, request's result will be an IDBCursorWithValue pointing at the first matching record, or null if there were no matching records.
*/
openCursor(query?: IDBValidKey | IDBKeyRange | null, direction?: IDBCursorDirection): IDBRequest;
/**
* Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in store are matched.
*
* If successful, request's result will be an IDBCursor pointing at the first matching record, or null if there were no matching records.
*/
openKeyCursor(query?: IDBValidKey | IDBKeyRange | null, direction?: IDBCursorDirection): IDBRequest;
/**
* Adds or updates a record in store with the given value and key.
*
* If the store uses in-line keys and key is specified a "DataError" DOMException will be thrown.
*
* If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a "ConstraintError" DOMException.
*
* If successful, request's result will be the record's key.
*/
put(value: any, key?: IDBValidKey): IDBRequest;
}
declare var IDBObjectStore: {
prototype: IDBObjectStore;
new(): IDBObjectStore;
};
interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
"blocked": Event;
"upgradeneeded": IDBVersionChangeEvent;
}
/** Also inherits methods from its parents IDBRequest and EventTarget. */
interface IDBOpenDBRequest extends IDBRequest {
onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null;
onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null;
addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var IDBOpenDBRequest: {
prototype: IDBOpenDBRequest;
new(): IDBOpenDBRequest;
};
interface IDBRequestEventMap {
"error": Event;
"success": Event;
}
/** The request object does not initially contain any information about the result of the operation, but once information becomes available, an event is fired on the request, and the information becomes available through the properties of the IDBRequest instance. */
interface IDBRequest extends EventTarget {
/** When a request is completed, returns the error (a DOMException), or null if the request succeeded. Throws a "InvalidStateError" DOMException if the request is still pending. */
readonly error: DOMException | null;
onerror: ((this: IDBRequest, ev: Event) => any) | null;
onsuccess: ((this: IDBRequest, ev: Event) => any) | null;
/** Returns "pending" until a request is complete, then returns "done". */
readonly readyState: IDBRequestReadyState;
/** When a request is completed, returns the result, or undefined if the request failed. Throws a "InvalidStateError" DOMException if the request is still pending. */
readonly result: T;
/** Returns the IDBObjectStore, IDBIndex, or IDBCursor the request was made against, or null if is was an open request. */
readonly source: IDBObjectStore | IDBIndex | IDBCursor;
/** Returns the IDBTransaction the request was made within. If this as an open request, then it returns an upgrade transaction while it is running, or null otherwise. */
readonly transaction: IDBTransaction | null;
addEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var IDBRequest: {
prototype: IDBRequest;
new(): IDBRequest;
};
interface IDBTransactionEventMap {
"abort": Event;
"complete": Event;
"error": Event;
}
interface IDBTransaction extends EventTarget {
/** Returns the transaction's connection. */
readonly db: IDBDatabase;
/** If the transaction was aborted, returns the error (a DOMException) providing the reason. */
readonly error: DOMException | null;
/** Returns the mode the transaction was created with ("readonly" or "readwrite"), or "versionchange" for an upgrade transaction. */
readonly mode: IDBTransactionMode;
/** Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database. */
readonly objectStoreNames: DOMStringList;
onabort: ((this: IDBTransaction, ev: Event) => any) | null;
oncomplete: ((this: IDBTransaction, ev: Event) => any) | null;
onerror: ((this: IDBTransaction, ev: Event) => any) | null;
/** Aborts the transaction. All pending requests will fail with a "AbortError" DOMException and all changes made to the database will be reverted. */
abort(): void;
commit(): void;
/** Returns an IDBObjectStore in the transaction's scope. */
objectStore(name: string): IDBObjectStore;
addEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
declare var IDBTransaction: {
prototype: IDBTransaction;
new(): IDBTransaction;
};
/** This IndexedDB API interface indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. */
interface IDBVersionChangeEvent extends Event {
readonly newVersion: number | null;
readonly oldVersion: number;
}
declare var IDBVersionChangeEvent: {
prototype: IDBVersionChangeEvent;
new(type: string, eventInitDict?: IDBVersionChangeEventInit): IDBVersionChangeEvent;
};
interface ImageBitmap {
/** Returns the intrinsic height of the image, in CSS pixels. */
readonly height: number;
/** Returns the intrinsic width of the image, in CSS pixels. */
readonly width: number;
/** Releases imageBitmap's underlying bitmap data. */
close(): void;
}
declare var ImageBitmap: {
prototype: ImageBitmap;
new(): ImageBitmap;
};
interface ImageBitmapRenderingContext {
/** Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound. */
transferFromImageBitmap(bitmap: ImageBitmap | null): void;
}
declare var ImageBitmapRenderingContext: {
prototype: ImageBitmapRenderingContext;
new(): ImageBitmapRenderingContext;
};
/** The underlying pixel data of an area of a