interface EventInit { bubbles?: boolean; cancelable?: boolean; } interface Event { readonly bubbles: boolean; readonly cancelable: boolean; readonly currentTarget: EventTarget; readonly defaultPrevented: boolean; readonly eventPhase: number; readonly isTrusted: boolean; readonly target: EventTarget; readonly timeStamp: number; readonly type: string; initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean): void; preventDefault(): void; stopImmediatePropagation(): void; stopPropagation(): void; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; } declare var Event: { prototype: Event; new(typeArg: string, eventInitDict?: EventInit): Event; readonly AT_TARGET: number; readonly BUBBLING_PHASE: number; readonly CAPTURING_PHASE: number; } interface EventListener { (evt: Event): void; } interface EventTarget { addEventListener(type: string, listener?: EventListener, useCapture?: boolean): void; dispatchEvent(evt: Event): boolean; removeEventListener(type: string, listener?: EventListener, useCapture?: boolean): void; } declare var EventTarget: { prototype: EventTarget; new(): EventTarget; } interface ProgressEventInit extends EventInit { lengthComputable?: boolean; loaded?: number; total?: number; } interface ProgressEvent extends Event { readonly lengthComputable: boolean; readonly loaded: number; readonly total: number; initProgressEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, lengthComputableArg: boolean, loadedArg: number, totalArg: number): void; } declare var ProgressEvent: { prototype: ProgressEvent; new(type: string, eventInitDict?: ProgressEventInit): ProgressEvent; } interface ErrorEventInit extends EventInit { message?: string; filename?: string; lineno?: number; colno?: number; error?: any; } 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(type: string, errorEventInitDict?: ErrorEventInit): ErrorEvent; } interface CloseEventInit extends EventInit { wasClean?: boolean; code?: number; reason?: string; } interface CloseEvent extends Event { readonly code: number; readonly reason: string; readonly wasClean: boolean; initCloseEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, wasCleanArg: boolean, codeArg: number, reasonArg: string): void; } declare var CloseEvent: { prototype: CloseEvent; new(typeArg: string, eventInitDict?: CloseEventInit): CloseEvent; } interface MessageEventInit extends EventInit { lastEventId?: string; channel?: string; data?: any; origin?: string; source?: any; ports?: MessagePort[]; } interface MessageEvent extends Event { readonly data: any; readonly origin: string; readonly ports: any; readonly source: any; initMessageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, dataArg: any, originArg: string, lastEventIdArg: string, sourceArg: any): void; } declare var MessageEvent: { prototype: MessageEvent; new(type: string, eventInitDict?: MessageEventInit): MessageEvent; } declare var MessageEvent: { prototype: MessageEvent; new(type: string, eventInitDict?: MessageEventInit): MessageEvent; } interface MessagePortEventMap { "message": MessageEvent; } interface MessagePort extends EventTarget { onmessage: (this: MessagePort, ev: MessageEvent) => any; close(): void; postMessage(message?: any, transfer?: any[]): void; start(): void; addEventListener(type: K, listener: (this: MessagePort, ev: MessagePortEventMap[K]) => any, useCapture?: boolean): void; } declare var MessagePort: { prototype: MessagePort; new(): MessagePort; } interface CordovaPlugins {} interface Navigator {} interface Document {} interface Cordova { plugins: CordovaPlugins; } interface Window { plugins: CordovaPlugins; cordova: Cordova; navigator: Navigator; window: Window; document: Document; } declare var navigator: Navigator; declare var window: Window; declare var document: Document; declare var plugins: CordovaPlugins; declare var cordova: Cordova; /** * Represents pixel data of a `Canvas` widget. */ declare class ImageData { constructor(data: Uint8ClampedArray, width: number, height?: number); constructor(width: number, height: number); /** * A one-dimensional array containing the data in RGBA order, with integer values between 0 and 255 (inclusive). */ readonly data: Uint8ClampedArray; /** * The actual height of the ImageData, in pixels. */ readonly width: number; /** * The actual height of the ImageData, in pixels. */ readonly height: number; } declare namespace JSX { type JsxFactory = ( this: tabris.JsxProcessor, type: {new (...args: any[]): any }, attributes: object ) => Element; type Element = any; const jsxFactory: unique symbol; const jsxType: unique symbol; function createElement(type: Function|string, attributes: object, ...children: Array): ElementClass; function install(jsxProcessor: tabris.JsxProcessor): void; interface ElementClass { jsxAttributes?: object; [JSX.jsxFactory]: JsxFactory; } interface ElementAttributesProperty { jsxAttributes: any; } interface ElementChildrenAttribute { children?: any; } interface IntrinsicElements { br: {children?: never}; b: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; span: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; big: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; i: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; small: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; strong: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; ins: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; del: {children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; a: {href?: string, children?: string|string[], font?: tabris.FontValue, textColor?: tabris.ColorValue}; } } declare var secureStorage: Storage; declare var device: tabris.Device; declare var createImageBitmap: typeof tabris.ImageBitmap.createImageBitmap; declare var __dirname: string; declare var __filename: string; declare var module: tabris.Module; declare var exports: object; declare var require: (request: string) => object; type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array; interface WebSocketEventMap { "close": CloseEvent; "error": Event; "message": MessageEvent; "open": Event; } interface WebSocket extends EventTarget { binaryType: string; readonly bufferedAmount: number; readonly extensions: string; onclose: (this: WebSocket, ev: CloseEvent) => any; onerror: (this: WebSocket, ev: Event) => any; onmessage: (this: WebSocket, ev: MessageEvent) => any; onopen: (this: WebSocket, ev: Event) => any; readonly protocol: string; readonly readyState: number; readonly url: string; close(code?: number, reason?: string): void; send(data: any): void; readonly CLOSED: number; readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; addEventListener(type: K, listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, useCapture?: boolean): void; } declare var WebSocket: { prototype: WebSocket; new(url: string, protocols?: string | string[]): WebSocket; readonly CLOSED: number; readonly CLOSING: number; readonly CONNECTING: number; readonly OPEN: number; } interface WorkerEventMap { "message": MessageEvent; "error": Event; "messageerror": Event; } interface Worker extends EventTarget { onerror: (this: Worker, ev: Event) => any; onmessageerror: (this: Worker, ev: Event) => any; onmessage: (this: Worker, ev: MessageEvent) => any; onopen: (this: Worker, ev: Event) => any; readonly protocol: string; readonly readyState: number; readonly url: string; postMessage(data: any, transferList?: Array): void; terminate(): void; addEventListener(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, useCapture?: boolean): void; } declare var Worker: { prototype: Worker; new(scriptPath: string): Worker; }; interface XMLHttpRequestEventTarget { onabort: (this: XMLHttpRequestEventTarget, ev: Event) => any; onerror: (this: XMLHttpRequestEventTarget, ev: ErrorEvent) => any; onload: (this: XMLHttpRequestEventTarget, ev: Event) => any; onloadend: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; onloadstart: (this: XMLHttpRequestEventTarget, ev: Event) => any; onprogress: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; ontimeout: (this: XMLHttpRequestEventTarget, ev: ProgressEvent) => any; addEventListener(type: K, listener: (this: XMLHttpRequestEventTarget, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } interface XMLHttpRequestEventTargetEventMap { "abort": Event; "error": ErrorEvent; "load": Event; "loadend": ProgressEvent; "loadstart": Event; "progress": ProgressEvent; "timeout": ProgressEvent; } interface XMLHttpRequestEventMap extends XMLHttpRequestEventTargetEventMap { "readystatechange": Event; } interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { onreadystatechange: (this: XMLHttpRequest, ev: Event) => any; readonly readyState: number; readonly response: any; readonly responseText: string; responseType: 'text' | 'arraybuffer' | ''; readonly status: number; readonly statusText: string; timeout: number; readonly upload: XMLHttpRequestUpload; withCredentials: boolean; abort(): void; getAllResponseHeaders(): string; getResponseHeader(header: string): string | null; open(method: string, url: string, async?: boolean, user?: string, password?: string): void; send(data?: string | ArrayBuffer | Blob | FormData): void; setRequestHeader(header: string, value: string): void; readonly DONE: number; readonly HEADERS_RECEIVED: number; readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; addEventListener(type: K, listener: (this: XMLHttpRequest, ev: XMLHttpRequestEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } declare var XMLHttpRequest: { prototype: XMLHttpRequest; new(): XMLHttpRequest; readonly DONE: number; readonly HEADERS_RECEIVED: number; readonly LOADING: number; readonly OPENED: number; readonly UNSENT: number; } interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { addEventListener(type: K, listener: (this: XMLHttpRequestUpload, ev: XMLHttpRequestEventTargetEventMap[K]) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void; } declare var XMLHttpRequestUpload: { prototype: XMLHttpRequestUpload; new(): XMLHttpRequestUpload; } // $ /** * A shortcut to [`tabris.contentView.find()`](./Composite.md#findselector). Returns a collection * containing all descendants of contentView that match the given selector. This does *not* include any * widgets in the drawer, a popover, or an encapsulated custom component. A custom component is * encapsulated if it overrides the `children()` method or uses the `@component` decorator. * @param selector A selector expression or a predicate function to filter the results. */ declare function $(selector?: tabris.Selector): tabris.WidgetCollection; /** * A JSX stateless functional component that groups all given widgets in a WidgetCollection * @param attributes This parameter needs to be null since <$> does not support any attributes * @param children The widgets to be included in the resulting WidgetCollection instance. */ declare function $(attributes: {children: tabris.JSXChildren}|null, children: tabris.JSXChildren): tabris.WidgetCollection; /** * A JSX stateless functional component that joins any given content in to a single string. * @param attributes This parameter needs to be null since <$> does not support any attributes. * @param children The content of the resulting string. */ declare function $(attributes: {children: string|number|boolean|Array}|null, children: string|number|boolean|Array): string; /** * Returns the non-disposed `NativeObject` instance (e.g. a widget) associated with the given cid * number. The number can be obtained via the [cid](./NativeObject.md#cid) property. Example: If the cid * of an object is `'$23'` it can be obtained by `$(23)`. The cid is visible in the log when passing a * NativeObject to any log method, e.g. [`console.log(widget)`](./Console.md#logvalues), or * [`console.dirxml(widget)`](./Console.md#dirxmlobject). The native object may then be obtained using * the developer console or the interactive console feature for the tabris CLI serve command. * This feature is meant for debugging purposes only. **Using it in production code is dangerous since * it allows interfering with the internals of the framework or encapsulated components.** Also, the * `cid` of a NativeObject is not stable, meaning it can change each time the code is executed. * @param cidNumber The cid number is the trailing part of the [cid](./NativeObject.md#cid) property string. */ declare function $(cidNumber: number): tabris.NativeObject; // Blob /** * Represents raw data of a given type. */ declare class Blob { /** * Represents raw data of a given type. */ public constructor(blobParts?: any[], options?: {type?: string}); /** * Reads the blob data into an ArrayBuffer and returns it in a promise. Each call creates a new * in-memory copy of the data. */ arrayBuffer(): Promise; /** * Decodes the blob data as a string and returns it in a promise. */ text(): Promise; /** * Size of the blob data in bytes * @constant */ readonly size: number; /** * The MIME type of the blob data * @constant */ readonly type: string; } // Console /** * The console object provides access to the [debugging console](../debug.md). */ declare class Console { /** * The console object provides access to the [debugging console](../debug.md). */ private constructor(); /** * Outputs an error message to the console if the first argument is false. * @param expression Any boolean expression. If the assertion is false, the error message is written to the console. * @param values A list of JavaScript values to output. */ assert(expression: boolean, ...values: any[]): void; /** * Logs the number of times that this particular call to count() has been called. * @param label If supplied, count() outputs the number of times it has been called with that label. */ count(label?: string): void; /** * Resets the counter. * @param label If label supplied, this function resets the count associated with that particular label. */ countReset(label?: string): void; /** * Outputs a debug message to the console. * @param values A list of JavaScript values to output. */ debug(...values: any[]): void; /** * XML tree representation of a given object, if available. Supported types include all widgets * `localStorage` and `secureStorage`. * *The output is NOT JSX, it is a human-readable summary that displays XML-conforming string * representations of some select property values. * @param object A JavaScript object */ dirxml(object: any): void; /** * Outputs an error message to the console. * @param values A list of JavaScript values to output. */ error(...values: any[]): void; /** * Creates a new inline group in the console output. This indents following console messages by an * additional spaces, until console.groupEnd() is called. * @param values A list of JavaScript values to output. */ group(...values: any[]): void; /** * Exits the current inline group in the console. */ groupEnd(): void; /** * Exits the current inline group in the console. */ groupEnd(): void; /** * Outputs an info message to the console. * @param values A list of JavaScript values to output. */ info(...values: any[]): void; /** * Outputs a message to the console. * @param values A list of JavaScript values to output */ log(...values: any[]): void; /** * Prints a stack trace in a platform-independent format. Framework internals are omitted. * Source maps are supported when side-loading code via the tabris CLI. */ trace(): void; /** * Outputs a warning message to the console. * @param values A list of JavaScript values to output. */ warn(...values: any[]): void; } declare var console: Console; // Crypto /** * The global `crypto` object provides an implementation of the `RandomSource` interface that can be * used to generate cryptographically secure random numbers. */ declare class Crypto { /** * The global `crypto` object provides an implementation of the `RandomSource` interface that can be * used to generate cryptographically secure random numbers. */ private constructor(); /** * Generates random numbers. * @param typedArray A typed array which will be filled with random numbers. The *same* array is also returned by this method. */ getRandomValues(typedArray: TypedArray): TypedArray; /** * @constant */ readonly subtle: SubtleCrypto; } declare var crypto: Crypto; // CryptoKey /** * Represents an in-memory cryptographic key to be used with the ${doc:SubtleCrypto} API. */ declare class CryptoKey { /** * Represents an in-memory cryptographic key to be used with the ${doc:SubtleCrypto} API. */ private constructor(); /** * @constant */ readonly algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'}; extractable: boolean; /** * @constant */ readonly type: 'secret' | 'private' | 'public'; /** * @constant */ readonly usages: string[]; } // File /** * Represents raw data of a given type and name. */ declare class File extends Blob { /** * Represents raw data of a given type and name. */ public constructor(blobParts: any[], name: string, options?: {type?: string, lastModified?: number}); /** * Unix timestamp of the last known modification of the file * @constant */ readonly lastModified: number; /** * The name or path of the file * @constant */ readonly name: string; } // FormData /** * FormData provides a way to construct a set of key/value pairs which can then be sent using fetch() or * XMLHttpRequest. It uses the same format a HTML form would use if the encoding type were set to * `multipart/form-data`. */ declare class FormData { /** * FormData provides a way to construct a set of key/value pairs which can then be sent using fetch() or * XMLHttpRequest. It uses the same format a HTML form would use if the encoding type were set to * `multipart/form-data`. */ public constructor(); [Symbol.iterator](): IterableIterator<[string, string | File]>; /** * Adds a string value associated with a given key. Any existing values for that key will be retained. * @param key * @param value */ append(key: string, value: string): void; /** * Adds binary data associated with a given key. Will be stored as an instance of `File` with its `name` * set to the given `filename` parameter. If no `filename` is given and the value is not already a named * `File` instance it will default to `'blob'`. Any existing values for that key will be retained. * @param key * @param value * @param filename */ append(key: string, value: Blob | File, filename?: string): void; /** * Removes all values associated with a given key. * @param key */ delete(key: string): void; entries(): IterableIterator<[string, string | File]>; /** * Returns the first value associated with a given key. * @param key */ get(key: string): string | File | null; /** * Returns all the values associated with a given key. * @param key */ getAll(key: string): string[]; /** * Returns true if there are any values associated with a given key. * @param key */ has(key: string): boolean; keys(): IterableIterator; /** * Adds a string value associated with a given key. Any existing values for that key will be replaced. * @param key * @param value */ set(key: string, value: string): void; /** * Adds binary data associated with a given key. Will be stored as an instance of `File` with its `name` * set to the given `filename` parameter. If no `filename` is given and the value is not already a named * `File` instance it will default to `'blob'`. Any existing values for that key will be replaced. * @param key * @param value * @param filename */ set(key: string, value: Blob | File, filename?: string): void; values(): IterableIterator; } // Headers /** * Represents a set of HTTP headers as used by `fetch()`. */ declare class Headers { /** * Represents a set of HTTP headers as used by `fetch()`. */ public constructor(headers?: Headers | Array<[string, string]> | {[header: string]: string}); [Symbol.iterator](): IterableIterator<[string, string]>; /** * Adds a value to a given header. Any existing values for that header will be retained. * @param name * @param value */ append(name: string, value: string): void; /** * Removes all values associated with a given header. * @param name */ delete(name: string): void; entries(): IterableIterator<[string, string]>; forEach(callback: ((value:string, name:string) => void)): void; /** * Returns the first value associated with a given header. * @param name */ get(name: string): string | null; /** * Returns all values associated with a given header. * @param name */ getAll(name: string): string[]; /** * Returns true if there are any values associated with a given header. * @param name */ has(name: string): boolean; keys(): IterableIterator; /** * Adds a string value associated with a given header. Any existing values for that header will be * replaced. * @param name * @param value */ set(name: string, value: string): void; values(): IterableIterator; } // Request /** * Represents an HTTP Request as used by `fetch()`. */ declare class Request { /** * Represents an HTTP Request as used by `fetch()`. */ public constructor(input: string | Request, init?: RequestInit); arrayBuffer(): Promise; blob(): Promise; clone(): Request; json(): Promise; json(): Promise; text(): Promise; readonly bodyUsed: boolean; readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload'; readonly context: 'audio' | 'beacon' | 'cspreport' | 'download' | 'embed' | 'eventsource' | 'favicon' | 'fetch' | 'font' | 'form' | 'frame' | 'hyperlink' | 'iframe' | 'image' | 'imageset' | 'import' | 'internal' | 'location' | 'manifest' | 'object' | 'ping' | 'plugin' | 'prefetch' | 'script' | 'serviceworker' | 'sharedworker' | 'style' | 'subresource' | 'track' | 'video' | 'worker' | 'xmlhttprequest' | 'xslt'; readonly credentials: 'include' | 'omit' | 'same-origin'; readonly headers: Headers; readonly method: string; readonly mode: 'cors' | 'no-cors' | 'same-origin'; readonly referrer: string; readonly url: string; } // RequestInit declare interface RequestInit { /** * The body of the request. GET or HEAD requests can not have a body. */ body?: Blob | FormData | string; cache?: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload'; credentials?: 'include' | 'omit' | 'same-origin'; /** * The headers to add to the request. */ headers?: Headers | Array<[string, string]> | {[header: string]: string}; /** * The request method, e.g., `'GET'`, `'POST'`. */ method?: string; mode?: 'cors' | 'no-cors' | 'same-origin'; /** * The network request timeout in milliseconds */ timeout?: number; } // Response /** * Represents an HTTP Response as used by `fetch()`. */ declare class Response { /** * Represents an HTTP Response as used by `fetch()`. */ public constructor(body?: Blob | FormData | string, init?: ResponseInit); arrayBuffer(): Promise; blob(): Promise; clone(): Response; json(): Promise; json(): Promise; text(): Promise; static error(): Response; static redirect(url: string, status: number): Response; readonly bodyUsed: boolean; readonly headers: Headers; readonly ok: boolean; readonly status: number; readonly statusText: string; readonly type: 'basic' | 'cors' | 'default' | 'error' | 'opaque'; readonly url: string; } // ResponseInit declare interface ResponseInit { headers?: Headers | Array<[string, string]> | {[header: string]: string}; status?: number; statusText?: string; } // SubtleCrypto /** * Provides a subset of the [cryptographic * functions](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) in the SubtleCrypto W3C * standard. */ declare class SubtleCrypto { /** * Provides a subset of the [cryptographic * functions](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) in the SubtleCrypto W3C * standard. */ private constructor(); /** * Decrypts the given raw data. Currently only supports the AES-GCM algorithm. * @param algorithm * @param key * @param data */ decrypt(algorithm: {name: 'AES-GCM', iv: ArrayBuffer | TypedArray, tagLength?: number}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise; /** * Takes a base key and derives an array of bits from it using the Elliptic Curve Diffie-Hellman (ECDH) * algorithm. * @param algorithm * @param baseKey * @param length * @param options */ deriveBits(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, length: number, options?: {authPromptTitle?: string, authPromptMessage?: string}): Promise; /** * Takes a base key and derives an array of bits from it using the HKDF algorithm. * @param algorithm * @param baseKey * @param length */ deriveBits(algorithm: {name: 'HKDF', hash: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', salt: ArrayBuffer | TypedArray, info: ArrayBuffer | TypedArray}, baseKey: CryptoKey, length: number): Promise; /** * Takes a base key and derives a secret key from it using the Elliptic Curve Diffie-Hellman (ECDH) * algorithm. * @param algorithm * @param baseKey * @param derivedKeyAlgorithm * @param extractable * @param keyUsages * @param options */ deriveKey(algorithm: {name: 'ECDH', namedCurve: 'P-256', public: CryptoKey}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[], options?: {authPromptTitle?: string, authPromptMessage?: string}): Promise; /** * Takes a base key and derives a secret key from it using the HKDF algorithm. * @param algorithm * @param baseKey * @param derivedKeyAlgorithm * @param extractable * @param keyUsages */ deriveKey(algorithm: {name: 'HKDF', hash: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', salt: ArrayBuffer | TypedArray, info: ArrayBuffer | TypedArray}, baseKey: CryptoKey, derivedKeyAlgorithm: {name: 'AES-GCM', length: number}, extractable: boolean, keyUsages: string[]): Promise; /** * Provides the digest value of the given data as an ArrayBuffer. Fo this the method uses the hashing * algorithms provided by the operating system. * @param algorithm A string defining the hash function to use. * @param data The data to be digested. */ digest(algorithm: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512', data: TypedArray | ArrayBuffer): Promise; /** * Encrypts the given raw data. Currently only supports the AES-GCM algorithm. * @param algorithm * @param key * @param data */ encrypt(algorithm: {name: 'AES-GCM', iv: ArrayBuffer | TypedArray, tagLength?: number}, key: CryptoKey, data: ArrayBuffer | TypedArray): Promise; /** * Converts `CryptoKey` instances into a portable format. If the key's `extractable` is set to `true`, * returns the raw key material in SPKI format or as raw bytes. If the key's `extractable` is set to * `false`, for ECDSA and ECDH keys returns an opaque handle to the key in the device's trusted * execution environment, and throws for other key formats. * @param format * @param key */ exportKey(format: 'raw' | 'spki', key: CryptoKey): Promise; /** * Generates new keys. Currently only supports the Elliptic Curve Diffie-Hellman (ECDH) and Elliptic * Curve Digital Signature Algorithm (ECDSA) algorithms to generate key pairs. When `extractable` is set * to `true`, the raw key material can be exported using `exportKey`. When `extractable` is set to * `false`, for ECDSA and ECDH keys `exportKey` returns an opaque handle to the key in the device's * trusted execution environment, and throws for other key formats. * @param algorithm * @param extractable * @param keyUsages * @param options */ generateKey(algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'}, extractable: boolean, keyUsages: string[], options?: {usageRequiresAuth?: boolean}): Promise<{privateKey: CryptoKey, publicKey: CryptoKey}>; /** * Takes an external key in a portable format and returns a CryptoKey object that can be used with the * SubtleCrypto API. Keys may be in spki or pkcs8 format. * @param format * @param keyData * @param algorithm * @param extractable * @param keyUsages */ importKey(format: 'spki' | 'pkcs8' | 'raw', keyData: ArrayBuffer | TypedArray, algorithm: {name: 'ECDH' | 'ECDSA', namedCurve: 'P-256'} | {name: 'AES-GCM'} | 'HKDF' | 'AES-GCM', extractable: boolean, keyUsages: string[]): Promise; /** * Signs the given data. Currently only supports creating ECDSA signatures in DER format. * @param algorithm * @param key * @param data * @param options */ sign(algorithm: {name: 'ECDSAinDERFormat', hash: 'SHA-256'}, key: CryptoKey, data: ArrayBuffer | TypedArray, options?: {authPromptTitle?: string, authPromptMessage?: string}): Promise; /** * Verifies the given signature against the data. Currently only supports verifying ECDSA signatures in * DER format. * @param algorithm * @param key * @param signature * @param data */ verify(algorithm: {name: 'ECDSAinDERFormat', hash: 'SHA-256'}, key: CryptoKey, signature: ArrayBuffer | TypedArray, data: ArrayBuffer | TypedArray): Promise; } // fetch declare function fetch(url: string | Request, init?: RequestInit): Promise; // Storage /** * The `localStorage` object allows storing key-value pairs in a persistent store. Both keys and values * are stored as strings. * In addition Tabris.js adds support for a `secureStorage` available in the global scope. This is a * drop-in replacement for `localStorage` that keeps data encrypted using the Keychain on iOS and the * AndroidKeyStore on Android 6+. Note that on Android 5 the store is encrypted but does not use * hardware encryption. * The `localStorage` is only meant to store relatively short strings. To store larger amounts of data * it is recommended to use the [FileSystem](./fs.html) API. */ declare class Storage { /** * The `localStorage` object allows storing key-value pairs in a persistent store. Both keys and values * are stored as strings. * In addition Tabris.js adds support for a `secureStorage` available in the global scope. This is a * drop-in replacement for `localStorage` that keeps data encrypted using the Keychain on iOS and the * AndroidKeyStore on Android 6+. Note that on Android 5 the store is encrypted but does not use * hardware encryption. * The `localStorage` is only meant to store relatively short strings. To store larger amounts of data * it is recommended to use the [FileSystem](./fs.html) API. */ private constructor(); /** * Remove all key/value pairs from the storage. */ clear(): void; /** * Retrieves the value associated with the given key. * @param key */ getItem(key: string): string | null; /** * Returns the name of the key at the given index in the storage. The order of keys is platform * dependent, you should not rely on it to be deterministic * @param index */ key(index: number): string; /** * Removes the given key/value pair from the storage. * @param key */ removeItem(key: string): void; /** * Stores a string value using the given key. * @param key * @param value */ setItem(key: string, value: string): void; /** * The number of items in the storage. * @constant */ readonly length: number; } declare var localStorage: Storage; // Timer /** * Cancels the running interval associated with the given ID. When given an invalid ID, nothing happens. * @param id The ID that was returned by `setInterval`. */ declare function clearInterval(id: any): void; /** * Cancels the running timeout associated with the given ID. When given an invalid ID, nothing happens. * @param id The ID that was returned by `setTimeout`. */ declare function clearTimeout(id: any): void; /** * Calls the given function repeatedly, each times waiting the given delay. The actual delay may be * slightly longer than the given one. * @param callback The function to call. * @param delay The delay in milliseconds. * @param params One or more values passed on to the callback. */ declare function setInterval(callback: Function, delay?: number, ...params: any[]): any; /** * Calls the given function with `param` (and all following parameters) after the specified delay. The * actual delay may be slightly longer than the given one. * @param callback The function to call. * @param delay The delay in milliseconds. * @param params One or more values passed on to the callback. */ declare function setTimeout(callback: Function, delay?: number, ...params: any[]): any;