react-native-firebase/lib/modules/perf/Trace.js

29 lines
638 B
JavaScript
Raw Normal View History

/**
* @flow
* Trace representation wrapper
*/
import { getNativeModule } from '../../utils/native';
import type PerformanceMonitoring from './';
2017-05-24 11:37:52 +00:00
export default class Trace {
identifier: string;
_perf: PerformanceMonitoring;
2017-05-24 11:37:52 +00:00
constructor(perf: PerformanceMonitoring, identifier: string) {
this._perf = perf;
2017-05-24 11:37:52 +00:00
this.identifier = identifier;
}
start(): void {
getNativeModule(this._perf).start(this.identifier);
2017-05-24 11:37:52 +00:00
}
stop(): void {
getNativeModule(this._perf).stop(this.identifier);
2017-05-24 11:37:52 +00:00
}
incrementCounter(event: string): void {
getNativeModule(this._perf).incrementCounter(this.identifier, event);
2017-05-24 11:37:52 +00:00
}
}