Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
duration: number;
}
export interface PerformanceEvent extends EchoEvent {}
export interface PerformanceBackendOptions {
url?: string;
}
/**
* Echo's performance metrics consumer
* Reports performance metrics to given url (TODO)
*/
export class PerformanceBackend implements EchoBackend {
private buffer: PerformanceEvent[] = [];
supportedEvents = [EchoEventType.Performance];
constructor(public options: PerformanceBackendOptions) {}
addEvent = (e: EchoEvent) => {
this.buffer.push(e);
};
flush = () => {
if (this.buffer.length === 0) {
return;
}
const result = {
metrics: this.buffer,
};