all files / firebase/modules/perf/ Trace.js

100% Statements 5/5
100% Branches 0/0
100% Functions 4/4
100% Lines 5/5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29                                               
/**
 * @flow
 * Trace representation wrapper
 */
import { getNativeModule } from '../../utils/native';
import type PerformanceMonitoring from './';
 
export default class Trace {
  identifier: string;
  _perf: PerformanceMonitoring;
 
  constructor(perf: PerformanceMonitoring, identifier: string) {
    this._perf = perf;
    this.identifier = identifier;
  }
 
  start(): void {
    getNativeModule(this._perf).start(this.identifier);
  }
 
  stop(): void {
    getNativeModule(this._perf).stop(this.identifier);
  }
 
  incrementCounter(event: string): void {
    getNativeModule(this._perf).incrementCounter(this.identifier, event);
  }
}