UNPKG

@nativescript/core

Version:

A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.

73 lines (72 loc) 2.35 kB
export type HeaderInit = Headers | string[][] | Record<string, string>; export declare class Headers { private map; constructor(headers?: HeaderInit); 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(callback: (value: string, name: string, headers: Headers) => void, thisArg?: any): void; keys(): IterableIterator<string>; values(): IterableIterator<string>; entries(): IterableIterator<[string, string]>; [Symbol.iterator](): IterableIterator<[string, string]>; } export declare class Body { bodyUsed: boolean; _bodyInit: any; protected _bodyText?: string; protected _bodyBlob?: Blob; protected _bodyFormData?: FormData; protected _bodyArrayBuffer?: ArrayBuffer; protected _noBody?: boolean; protected headers: Headers; protected _initBody(body: any): void; blob?(): Promise<Blob>; arrayBuffer(): Promise<ArrayBuffer>; text(): Promise<string>; formData?(): Promise<FormData>; json(): Promise<any>; } export type RequestInfo = string | Request; export interface RequestInit { method?: string; headers?: HeaderInit; body?: any; mode?: string | null; credentials?: RequestCredentials; cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached'; signal?: AbortSignal; } export declare class Request extends Body { url: string; credentials: RequestCredentials; headers: Headers; method: string; mode: string | null; signal?: AbortSignal; referrer: string | null; constructor(input: RequestInfo, options?: RequestInit); clone(): Request; } export interface ResponseInit { status?: number; statusText?: string; headers?: HeaderInit; url?: string; } export declare class Response extends Body { type: string; status: number; ok: boolean; statusText: string; headers: Headers; url: string; constructor(bodyInit: any, options?: ResponseInit); clone(): Response; static error(): Response; static redirect(url: string, status: number): Response; } export declare let DOMException: any; export declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;