UNPKG

react-native-devtools-sync

Version:

A tool for syncing React Query state to an external Dev Tools

59 lines (58 loc) 2.67 kB
import { Socket } from 'socket.io-client'; import { NetworkRequest } from './types'; /** * Helper function to send network request data to the dashboard * * This function should be called by your network interceptors when a request is made, * when a response is received, or when an error occurs. * * @param socket The socket.io client instance * @param request The network request data to send * @param persistentDeviceId The unique identifier for this device * @param enableLogs Whether to enable logging */ export declare function sendNetworkRequest(socket: Socket | undefined, request: NetworkRequest, persistentDeviceId: string, enableLogs?: boolean): void; /** * Example implementation of fetch interceptor * * This is an example of how you might implement a fetch interceptor * to capture network requests and send them to the dashboard. * * @param socket The socket.io client instance * @param persistentDeviceId The unique identifier for this device * @param enableLogs Whether to enable logging */ export declare function setupFetchInterceptor(socket: Socket | undefined, persistentDeviceId: string, enableLogs?: boolean): () => void; /** * Example implementation of XMLHttpRequest interceptor * * This is an example of how you might implement an XMLHttpRequest interceptor * to capture network requests and send them to the dashboard. * * @param socket The socket.io client instance * @param persistentDeviceId The unique identifier for this device * @param enableLogs Whether to enable logging */ export declare function setupXHRInterceptor(socket: Socket | undefined, persistentDeviceId: string, enableLogs?: boolean): () => void; /** * Example implementation of WebSocket interceptor * * This is an example of how you might implement a WebSocket interceptor * to capture WebSocket messages and send them to the dashboard. * * @param socket The socket.io client instance * @param persistentDeviceId The unique identifier for this device * @param enableLogs Whether to enable logging */ export declare function setupWebSocketInterceptor(socket: Socket | undefined, persistentDeviceId: string, enableLogs?: boolean): () => void; /** * Set up all network interceptors * * This function sets up interceptors for fetch, XMLHttpRequest, and WebSocket * to capture network requests and send them to the dashboard. * * @param socket The socket.io client instance * @param persistentDeviceId The unique identifier for this device * @param enableLogs Whether to enable logging */ export declare function setupNetworkInterceptors(socket: Socket | undefined, persistentDeviceId: string, enableLogs?: boolean): () => void;