UNPKG

dabbjs

Version:

general javascript library

72 lines (71 loc) 1.86 kB
/** * AJAX with promise */ export declare abstract class Ajaxp { static readonly sGet: string; static readonly sPost: string; /** * template default object properties */ static readonly xobj: object; static readonly rt: string; /** * gets HTTP AJAX object */ static x(): XMLHttpRequest; /** * returns a url query object * @param data object with properties * @param ask true to append, false only props. GET appends to url, POST in body * @returns query string */ static query(data: { [key: string]: any; }, ask: boolean): string; /** * copies default object properties not in dest object * @param io template object * @param obj dest object * @returns obj updated */ static update(io: { [key: string]: any; }, obj: { [key: string]: any; }): { [key: string]: any; }; /** * performs the AJAX request * @param url url * @param ox object with values * @returns a promise */ static send<T>(url: string, ox: { [key: string]: any; }): Promise<T>; /** * performs a AJAX GET * @param url url * @param ox options below: * * - method: GET * - responseType: json|text|document. default is "text", for xml use document * - data: object with values, it's sent appended to url ? & */ static get<T>(url: string, ox?: { [key: string]: any; }): Promise<T>; /** * performs a AJAX POST * @param url url * @param ox options below: * * - method: POST * - responseType: json|text|document. default is "text", for xml use document * - data: object with values, it's sent in the body */ static post<T>(url: string, ox?: { [key: string]: any; }): Promise<T>; }