ts-mjs
Version:
TypeScript is a language for application scale JavaScript development
1,529 lines (1,366 loc) • 95 kB
TypeScript
/*! *****************************************************************************
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.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/////////////////////////////
/// Worker APIs
/////////////////////////////
interface AddEventListenerOptions extends EventListenerOptions {
once?: boolean;
passive?: boolean;
}
interface Algorithm {
name: string;
}
interface BlobPropertyBag {
type?: string;
}
interface CacheQueryOptions {
cacheName?: string;
ignoreMethod?: boolean;
ignoreSearch?: boolean;
ignoreVary?: boolean;
}
interface ClientQueryOptions {
includeUncontrolled?: boolean;
type?: ClientTypes;
}
interface CloseEventInit extends EventInit {
code?: number;
reason?: string;
wasClean?: boolean;
}
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 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 ExtendableEventInit extends EventInit {
}
interface ExtendableMessageEventInit extends ExtendableEventInit {
data?: any;
lastEventId?: string;
origin?: string;
ports?: MessagePort[];
source?: Client | ServiceWorker | MessagePort;
}
interface FetchEventInit extends ExtendableEventInit {
clientId?: string;
preloadResponse: Promise<any>;
request: Request;
resultingClientId?: string;
targetClientId?: string;
}
interface FilePropertyBag extends BlobPropertyBag {
lastModified?: number;
}
interface GetNotificationOptions {
tag?: string;
}
interface IDBIndexParameters {
multiEntry?: boolean;
unique?: boolean;
}
interface IDBObjectStoreParameters {
autoIncrement?: boolean;
keyPath?: string | string[];
}
interface IDBVersionChangeEventInit extends EventInit {
newVersion?: number | null;
oldVersion?: number;
}
interface KeyAlgorithm {
name: string;
}
interface MessageEventInit extends EventInit {
channel?: string;
data?: any;
lastEventId?: string;
origin?: string;
ports?: MessagePort[];
source?: object | null;
}
interface NavigationPreloadState {
enabled?: boolean;
headerValue?: 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?: number;
vibrate?: VibratePattern;
}
interface PerformanceObserverInit {
buffered?: boolean;
entryTypes: string[];
}
interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
total?: number;
}
interface PromiseRejectionEventInit extends EventInit {
promise: Promise<any>;
reason?: any;
}
interface PushEventInit extends ExtendableEventInit {
data?: PushMessageDataInit;
}
interface PushSubscriptionChangeInit extends ExtendableEventInit {
newSubscription?: PushSubscription;
oldSubscription?: PushSubscription;
}
interface PushSubscriptionJSON {
endpoint?: string;
expirationTime?: number | null;
keys?: Record<string, string>;
}
interface PushSubscriptionOptionsInit {
applicationServerKey?: BufferSource | string;
userVisibleOnly?: boolean;
}
interface RegistrationOptions {
scope?: string;
type?: WorkerType;
updateViaCache?: ServiceWorkerUpdateViaCache;
}
interface RequestInit {
body?: BodyInit | null;
cache?: RequestCache;
credentials?: RequestCredentials;
headers?: HeadersInit;
integrity?: string;
keepalive?: boolean;
method?: string;
mode?: RequestMode;
redirect?: RequestRedirect;
referrer?: string;
referrerPolicy?: ReferrerPolicy;
signal?: object | null;
window?: any;
}
interface ResponseInit {
headers?: HeadersInit;
status?: number;
statusText?: string;
}
interface StorageEstimate {
quota?: number;
usage?: number;
}
interface SyncEventInit extends ExtendableEventInit {
lastChance?: boolean;
tag: string;
}
interface TextDecodeOptions {
stream?: boolean;
}
interface TextDecoderOptions {
fatal?: boolean;
ignoreBOM?: boolean;
}
interface EventListener {
(evt: Event): void;
}
interface AbstractWorkerEventMap {
"error": ErrorEvent;
}
interface AbstractWorker {
onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null;
addEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof AbstractWorkerEventMap>(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}
interface AesCfbParams extends Algorithm {
iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer;
}
interface AesCmacParams extends Algorithm {
length: number;
}
interface Blob {
readonly size: number;
readonly type: string;
slice(start?: number, end?: number, contentType?: string): Blob;
}
declare var Blob: {
prototype: Blob;
new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
};
interface Body {
readonly body: ReadableStream | null;
readonly bodyUsed: boolean;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
formData(): Promise<FormData>;
json(): Promise<any>;
text(): Promise<string>;
}
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<K extends keyof BroadcastChannelEventMap>(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof BroadcastChannelEventMap>(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;
};
interface BroadcastChannelEventMap {
message: MessageEvent;
messageerror: MessageEvent;
}
interface Cache {
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
delete(request: RequestInfo, options?: CacheQueryOptions): Promise<boolean>;
keys(request?: RequestInfo, options?: CacheQueryOptions): Promise<ReadonlyArray<Request>>;
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>;
matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise<ReadonlyArray<Response>>;
put(request: RequestInfo, response: Response): Promise<void>;
}
declare var Cache: {
prototype: Cache;
new(): Cache;
};
interface CacheStorage {
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
keys(): Promise<string[]>;
match(request: RequestInfo, options?: CacheQueryOptions): Promise<Response | undefined>;
open(cacheName: string): Promise<Cache>;
}
declare var CacheStorage: {
prototype: CacheStorage;
new(): CacheStorage;
};
interface Client {
readonly id: string;
readonly type: ClientTypes;
readonly url: string;
postMessage(message: any, transfer?: any[]): void;
}
declare var Client: {
prototype: Client;
new(): Client;
};
interface Clients {
claim(): Promise<void>;
get(id: string): Promise<any>;
matchAll(options?: ClientQueryOptions): Promise<ReadonlyArray<Client>>;
openWindow(url: string): Promise<WindowClient | null>;
}
declare var Clients: {
prototype: Clients;
new(): Clients;
};
interface CloseEvent extends Event {
readonly code: number;
readonly reason: string;
readonly wasClean: boolean;
/** @deprecated */
initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void;
}
declare var CloseEvent: {
prototype: CloseEvent;
new(type: string, eventInitDict?: CloseEventInit): CloseEvent;
};
interface ConcatParams extends Algorithm {
algorithmId: Uint8Array;
hash?: string | Algorithm;
partyUInfo: Uint8Array;
partyVInfo: Uint8Array;
privateInfo?: Uint8Array;
publicInfo?: Uint8Array;
}
interface Console {
memory: any;
assert(condition?: boolean, message?: string, ...data: any[]): void;
clear(): void;
count(label?: string): void;
debug(message?: any, ...optionalParams: any[]): void;
dir(value?: any, ...optionalParams: any[]): void;
dirxml(value: any): void;
error(message?: any, ...optionalParams: any[]): void;
exception(message?: string, ...optionalParams: any[]): void;
group(groupTitle?: string, ...optionalParams: any[]): void;
groupCollapsed(groupTitle?: string, ...optionalParams: any[]): void;
groupEnd(): void;
info(message?: any, ...optionalParams: any[]): void;
log(message?: any, ...optionalParams: any[]): void;
markTimeline(label?: string): void;
msIsIndependentlyComposed(element: object): boolean;
profile(reportName?: string): void;
profileEnd(): void;
select(element: object): void;
table(...tabularData: any[]): void;
time(label?: string): void;
timeEnd(label?: string): void;
timeStamp(label?: string): void;
timeline(label?: string): void;
timelineEnd(label?: string): void;
trace(message?: any, ...optionalParams: any[]): void;
warn(message?: any, ...optionalParams: any[]): void;
}
declare var Console: {
prototype: Console;
new(): Console;
};
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
readonly type: string;
readonly usages: string[];
}
declare var CryptoKey: {
prototype: CryptoKey;
new(): CryptoKey;
};
interface DOMException {
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;
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;
};
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;
}
interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null;
close(): void;
postMessage(message: any, transfer?: any[]): void;
addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(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 DhImportKeyParams extends Algorithm {
generator: Uint8Array;
prime: Uint8Array;
}
interface DhKeyAlgorithm extends KeyAlgorithm {
generator: Uint8Array;
prime: Uint8Array;
}
interface DhKeyDeriveParams extends Algorithm {
public: CryptoKey;
}
interface DhKeyGenParams extends Algorithm {
generator: Uint8Array;
prime: Uint8Array;
}
interface ErrorEvent extends Event {
readonly colno: number;
readonly error: any;
readonly filename: string;
readonly lineno: number;
readonly message: string;
initErrorEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, messageArg: string, filenameArg: string, linenoArg: number): void;
}
declare var ErrorEvent: {
prototype: ErrorEvent;
new(typeArg: string, eventInitDict?: ErrorEventInit): ErrorEvent;
};
interface Event {
readonly bubbles: boolean;
cancelBubble: boolean;
readonly cancelable: boolean;
readonly composed: boolean;
readonly currentTarget: EventTarget | null;
readonly defaultPrevented: boolean;
readonly eventPhase: number;
readonly isTrusted: boolean;
returnValue: boolean;
readonly srcElement: object | null;
readonly target: EventTarget | null;
readonly timeStamp: number;
readonly type: string;
deepPath(): EventTarget[];
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
readonly NONE: number;
}
declare var Event: {
prototype: Event;
new(typeArg: string, eventInitDict?: EventInit): Event;
readonly AT_TARGET: number;
readonly BUBBLING_PHASE: number;
readonly CAPTURING_PHASE: number;
readonly NONE: number;
};
interface EventListenerObject {
handleEvent(evt: Event): void;
}
interface EventSource extends EventTarget {
readonly CLOSED: number;
readonly CONNECTING: number;
readonly OPEN: number;
onerror: (evt: MessageEvent) => any;
onmessage: (evt: MessageEvent) => any;
onopen: (evt: MessageEvent) => any;
readonly readyState: number;
readonly url: string;
readonly withCredentials: boolean;
close(): void;
}
declare var EventSource: {
prototype: EventSource;
new(url: string, eventSourceInitDict?: EventSourceInit): EventSource;
};
interface EventSourceInit {
readonly withCredentials: boolean;
}
interface EventTarget {
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
dispatchEvent(evt: Event): boolean;
removeEventListener(type: string, listener?: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
}
declare var EventTarget: {
prototype: EventTarget;
new(): EventTarget;
};
interface ExtendableEvent extends Event {
waitUntil(f: Promise<any>): void;
}
declare var ExtendableEvent: {
prototype: ExtendableEvent;
new(type: string, eventInitDict?: ExtendableEventInit): ExtendableEvent;
};
interface ExtendableMessageEvent extends ExtendableEvent {
readonly data: any;
readonly lastEventId: string;
readonly origin: string;
readonly ports: ReadonlyArray<MessagePort>;
readonly source: Client | ServiceWorker | MessagePort | null;
}
declare var ExtendableMessageEvent: {
prototype: ExtendableMessageEvent;
new(type: string, eventInitDict?: ExtendableMessageEventInit): ExtendableMessageEvent;
};
interface FetchEvent extends ExtendableEvent {
readonly clientId: string;
readonly preloadResponse: Promise<any>;
readonly request: Request;
readonly resultingClientId: string;
readonly targetClientId: string;
respondWith(r: Promise<Response>): void;
}
declare var FetchEvent: {
prototype: FetchEvent;
new(type: string, eventInitDict: FetchEventInit): FetchEvent;
};
interface File extends Blob {
readonly lastModified: number;
readonly name: string;
}
declare var File: {
prototype: File;
new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
};
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;
}
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, label?: string): void;
readonly DONE: number;
readonly EMPTY: number;
readonly LOADING: number;
addEventListener<K extends keyof FileReaderEventMap>(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof FileReaderEventMap>(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;
};
interface FileReaderSync {
readAsArrayBuffer(blob: Blob): ArrayBuffer;
readAsBinaryString(blob: Blob): string;
readAsDataURL(blob: Blob): string;
readAsText(blob: Blob, label?: string): string;
}
declare var FileReaderSync: {
prototype: FileReaderSync;
new(): FileReaderSync;
};
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(form?: object): FormData;
};
interface GlobalFetch {
fetch(input?: Request | string, init?: RequestInit): Promise<Response>;
}
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;
};
interface HkdfCtrParams extends Algorithm {
context: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer;
hash: string | Algorithm;
label: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer;
}
interface IDBArrayKey extends Array<IDBValidKey> {
}
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 | IDBKeyRange;
/**
* Returns the effective key of the cursor.
* Throws a "InvalidStateError" DOMException if the cursor is advancing or is finished.
*/
readonly primaryKey: IDBValidKey | IDBKeyRange;
/**
* 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 matching or
* after key.
*/
continue(key?: IDBValidKey | IDBKeyRange): 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 | IDBKeyRange, primaryKey: IDBValidKey | IDBKeyRange): 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;
};
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;
}
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, optionalParameters?: 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<K extends keyof IDBDatabaseEventMap>(type: K, listener: (this: IDBDatabase, ev: IDBDatabaseEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof IDBDatabaseEventMap>(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;
};
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;
/**
* 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 specified version. If the database already exists
* with a lower version and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close, then an upgrade
* will occur. If the database already exists with a higher
* version the request will fail. 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;
};
interface IDBIndex {
readonly keyPath: string | string[];
readonly multiEntry: boolean;
/**
* Updates the name of the store to newName.
* Throws an "InvalidStateError" DOMException if not called within an upgrade
* transaction.
*/
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(key?: 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(key: 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, 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, 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(key: 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(range?: IDBValidKey | IDBKeyRange, 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(range?: IDBValidKey | IDBKeyRange, direction?: IDBCursorDirection): IDBRequest;
}
declare var IDBIndex: {
prototype: IDBIndex;
new(): IDBIndex;
};
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;
};
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[];
/**
* Updates the name of the store to newName.
* Throws "InvalidStateError" DOMException if not called within an upgrade
* transaction.
*/
name: string;
/**
* Returns the associated transaction.
*/
readonly transaction: IDBTransaction;
add(value: any, key?: IDBValidKey | IDBKeyRange): 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(key?: 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(key: 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, 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, 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(range?: IDBValidKey | IDBKeyRange, 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, direction?: IDBCursorDirection): IDBRequest;
put(value: any, key?: IDBValidKey | IDBKeyRange): IDBRequest;
}
declare var IDBObjectStore: {
prototype: IDBObjectStore;
new(): IDBObjectStore;
};
interface IDBOpenDBRequestEventMap extends IDBRequestEventMap {
"blocked": Event;
"upgradeneeded": IDBVersionChangeEvent;
}
interface IDBOpenDBRequest extends IDBRequest {
onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null;
onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null;
addEventListener<K extends keyof IDBOpenDBRequestEventMap>(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof IDBOpenDBRequestEventMap>(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;
}
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: any;
/**
* 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<K extends keyof IDBRequestEventMap>(type: K, listener: (this: IDBRequest, ev: IDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof IDBRequestEventMap>(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;
/**
* 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;
/**
* Returns an IDBObjectStore in the transaction's scope.
*/
objectStore(name: string): IDBObjectStore;
addEventListener<K extends keyof IDBTransactionEventMap>(type: K, listener: (this: IDBTransaction, ev: IDBTransactionEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof IDBTransactionEventMap>(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;
};
interface IDBVersionChangeEvent extends Event {
readonly newVersion: number | null;
readonly oldVersion: number;
}
declare var IDBVersionChangeEvent: {
prototype: IDBVersionChangeEvent;
new(type: string, eventInitDict?: IDBVersionChangeEventInit): IDBVersionChangeEvent;
};
interface ImageBitmap {
readonly height: number;
readonly width: number;
close(): void;
}
interface ImageBitmapOptions {
colorSpaceConversion?: "none" | "default";
imageOrientation?: "none" | "flipY";
premultiplyAlpha?: "none" | "premultiply" | "default";
resizeHeight?: number;
resizeQuality?: "pixelated" | "low" | "medium" | "high";
resizeWidth?: number;
}
interface ImageData {
}
declare var ImageData: {
prototype: