fetch-jsonp
Version:
Fetch JSONP like a boss using Fetch API
23 lines (19 loc) • 528 B
TypeScript
declare function fetchJsonp(url: string, options?: fetchJsonp.Options): Promise<fetchJsonp.Response>;
declare namespace fetchJsonp {
interface Options {
timeout?: number;
jsonpCallback?: string;
jsonpCallbackFunction?: string;
nonce?: string;
crossorigin?: boolean | string;
referrerPolicy?: ReferrerPolicy;
charset?: string;
fetchPriority?: 'high' | 'low' | 'auto';
}
interface Response {
json(): Promise<any>;
json<T>(): Promise<T>;
ok: boolean;
}
}
export = fetchJsonp;