import { Metric } from "../../Metrics/Metric.mjs"; import { Plugin } from "../../Plugin/Plugin.mjs"; import { ProcessingQueue } from "./ProcessingQueue.mjs"; //#region src/Plugins/Reporter/ReporterPlugin.d.ts /** * Reporter Plugin * * This plugin is designed to efficiently send your metrics to an * external service. When registering this plugin on a `Metric`, it * will be posted to the service you specify each time its `stop()` * event is called. * * This plugin will attempt to batch multiple metrics together using a * processing queue to minimize the amount of requests going out in the * background of your application. It'll also use the `Beacon API` * wherever possible. * * Setting up the Reporting Plugin and Processing Queue: * * ```typescript * import { Metric, ReporterPlugin, ProcessingQueue } from "@ui-perf/metrics"; * * const Queue = new ProcessingQueue("/analytics", metrics => { * return JSON.stringify({ * metrics, * // any other data you wish to add to your requests * }); * }) * * ``` */ declare class ReporterPlugin = Metric> extends Plugin { private readonly processor; constructor(processor: ProcessingQueue); /** * Stop * * Enqueues the target metric to be sent to the `ProcessingQueue's` * endpoint */ protected stop(metric: T): void; /** * To JSON * * Modifies the return value of the `PageLoadPlugin` interface when passed * to `JSON.stringify` */ toJSON(): {}; } //#endregion export { ReporterPlugin };