export type AjaxGetOption = { headers: any; responseType: any; credentials: any; }; export type Callback = (...params: any[]) => any; /** * @classdesc * Ajax Utilities. It is static and should not be initiated. * @class * @static * @category core */ declare const Ajax: { /** * Get JSON data by jsonp * from https://gist.github.com/gf3/132080/110d1b68d7328d7bfe7e36617f7df85679a08968 * @param url - resource url * @param callback - callback function when completed */ jsonp: (url: string, callback: Callback) => any; /** * Fetch remote resource by HTTP "GET" method * @param {String} url - resource url * @param {Object} [options=null] - request options * @param {Object} [options.headers=null] - HTTP headers * @param {String} [options.responseType=null] - responseType * @param {String} [options.credentials=null] - if with credentials, set it to "include" * @param {Function} cb - callback function when completed * @return {Ajax} Ajax * @example * maptalks.Ajax.get( * 'url/to/resource', * (err, data) => { * if (err) { * throw new Error(err); * } * // do things with data * } * ); */ get: (url: string, options?: any, cb?: any) => any; /** * Fetch remote resource by HTTP "POST" method * @param {String} url - resource url * @param {Object} options - request options * @param {String|Object} options.postData - post data * @param {Object} [options.headers=null] - HTTP headers * @param {Function} cb - callback function when completed * @return {Ajax} Ajax * @example * maptalks.Ajax.post( * 'url/to/post', * { * postData : { * 'param0' : 'val0', * 'param1' : 1 * } * }, * (err, data) => { * if (err) { * throw new Error(err); * } * // do things with data * } * ); */ post: (url: string, options?: any, cb?: Callback) => any; _wrapCallback: (client: any, cb: Callback) => () => void; _getClient: (cb: Callback) => any; /** * Fetch resource as arraybuffer. * @param {String} url - url * @param {Object} [options=null] - options, same as Ajax.get * @param {Function} cb - callback function when completed. * @example * maptalks.Ajax.getArrayBuffer( * 'url/to/resource.bin', * (err, data) => { * if (err) { * throw new Error(err); * } * // data is a binary array * } * ); */ getArrayBuffer(url: string, options: any, cb: Callback): any; getImage(img: any, url: string, options: any): any; getJSON: (url: string, options?: any, cb?: Callback) => any; }; export default Ajax; //# sourceMappingURL=Ajax.d.ts.map