reactotron-react-native
Version:
A development tool to explore, inspect, and diagnose your React Native apps.
39 lines • 1.95 kB
TypeScript
type XHRInterceptorOpenCallback = (method: string, url: string, request: XMLHttpRequest) => void;
type XHRInterceptorSendCallback = (data: string, request: XMLHttpRequest) => void;
type XHRInterceptorRequestHeaderCallback = (header: string, value: string, request: XMLHttpRequest) => void;
type XHRInterceptorHeaderReceivedCallback = (responseContentType: string | undefined, responseSize: number | undefined, allHeaders: string, request: XMLHttpRequest) => void;
type XHRInterceptorResponseCallback = (status: number, timeout: number, response: string, responseURL: string, responseType: string, request: XMLHttpRequest) => void;
/**
* A network interceptor which monkey-patches XMLHttpRequest methods
* to gather all network requests/responses, in order to show their
* information in the React Native inspector development tool.
* This supports interception with XMLHttpRequest API, including Fetch API
* and any other third party libraries that depend on XMLHttpRequest.
*/
export declare const XHRInterceptor: {
/**
* Invoked before XMLHttpRequest.open(...) is called.
*/
setOpenCallback(callback: XHRInterceptorOpenCallback): void;
/**
* Invoked before XMLHttpRequest.send(...) is called.
*/
setSendCallback(callback: XHRInterceptorSendCallback): void;
/**
* Invoked after xhr's readyState becomes xhr.HEADERS_RECEIVED.
*/
setHeaderReceivedCallback(callback: XHRInterceptorHeaderReceivedCallback): void;
/**
* Invoked after xhr's readyState becomes xhr.DONE.
*/
setResponseCallback(callback: XHRInterceptorResponseCallback): void;
/**
* Invoked before XMLHttpRequest.setRequestHeader(...) is called.
*/
setRequestHeaderCallback(callback: XHRInterceptorRequestHeaderCallback): void;
isInterceptorEnabled(): boolean;
enableInterception(): void;
disableInterception(): void;
};
export {};
//# sourceMappingURL=xhr-interceptor.d.ts.map