/** * A collection of network-related functions */ /** * Defines an interface for objects that hold a net request result. */ export interface INetLoadResult { /** * A reference to original [[XMLHttpRequest]]. */ xhr: XMLHttpRequest; /** * Request response body. */ response?: string; /** * Response as a `Blob`, when `responseType` is `"blob"`. `response` then * holds its text. */ blob?: Blob; /** * Response `Content-Type`. */ type: string | null; /** * Was there an error? */ error: boolean; /** * The `target` passed to `load()`. */ target?: A; } /** * Options for `load()`. */ export interface INetRequestOptions { /** * Custom request headers to be added to HTTP(S) request. */ requestHeaders?: { key: string; value: string; }[]; /** * Specify expected response type. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType} for more info */ responseType?: XMLHttpRequestResponseType; /** * Sends credentials, such as cookies, with cross-origin requests. * * @default false * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials} for more info */ withCredentials?: boolean; } /** * Loads a file from `url` and returns a `Promise` of the result. The promise * is rejected, with `error: true` in the result, if the request fails or its * status is not 200. * * ```TypeScript * // Using await * let response = await am5.net.load( "http://www.my.com/data.json" ); * console.log( response.response ); * * // Using then() * am5.net.load( "http://www.my.com/data.json" ).then( ( response ) => { * console.log( response.response ); * } ); * ``` * ```JavaScript * // Using then() * am5.net.load( "http://www.my.com/data.json" ).then( function( response ) { * console.log( response.response ); * } ); * ``` * * @async * @see {@link https://www.amcharts.com/docs/v5/concepts/data/net-load-utility/} for more info * @param url URL for the file to load * @param target Any object, passed back as `target` in the result * @param options Request options * @return Result (Promise) */ export declare function load(url: string, target?: A, options?: INetRequestOptions): Promise>; /** * Returns textual representation of a Blob object. * * @param blob Target blob * @return Text promise */ export declare function readBlob(blob: Blob): Promise; //# sourceMappingURL=Net.d.ts.map