UNPKG

@algolia/algolia-browser-telemetry

Version:

<p align="center"> <img src="https://github.com/algolia/algolia-browser-telemetry/blob/master/doc/netinfo.blog.png?raw=true" height="380px"/> </p> <br/> <br/>

23 lines (22 loc) 900 B
import { Telemetry, Error, APIPayload } from './../types'; /** * Separate sendWithFetch from report so we can add a simple integration * test as report does not expose the API response * @param payload * @returns {Promise} */ export declare function sendWithFetch(payload: APIPayload): Promise<Response>; /** * In cases where neither Fetch or sendBeacon is supported we use XMLHttpRequest as a best * effort fallback. It gives us no guarantee that the data will be sent in onunload cases, * but it's better than not sending it at all. * @param payload * @returns {XMLHttpRequest} */ export declare function sendWithXMLHttpRequest(payload: APIPayload): XMLHttpRequest; export interface Reporter { error: (errors: Error[]) => boolean; telemetry: (telemetry: Telemetry[]) => boolean; } declare function createReporter(): Reporter; export default createReporter;