2017-05-24 11:37:52 +00:00
|
|
|
// @flow
|
|
|
|
import Trace from './Trace';
|
2017-06-30 16:23:32 +00:00
|
|
|
import ModuleBase from '../../utils/ModuleBase';
|
2017-05-24 11:37:52 +00:00
|
|
|
|
2017-06-30 16:23:32 +00:00
|
|
|
export default class PerformanceMonitoring extends ModuleBase {
|
2017-08-17 16:58:28 +00:00
|
|
|
static _NAMESPACE = 'perf';
|
|
|
|
static _NATIVE_MODULE = 'RNFirebasePerformance';
|
|
|
|
|
2017-09-25 22:19:13 +00:00
|
|
|
_native: Object;
|
|
|
|
|
2017-06-30 16:23:32 +00:00
|
|
|
constructor(firebaseApp: Object, options: Object = {}) {
|
2017-08-17 16:58:28 +00:00
|
|
|
super(firebaseApp, options);
|
2017-05-25 22:39:06 +00:00
|
|
|
}
|
2017-05-24 11:37:52 +00:00
|
|
|
|
2017-05-25 07:41:43 +00:00
|
|
|
/**
|
|
|
|
* Globally enable or disable performance monitoring
|
|
|
|
* @param enabled
|
|
|
|
* @returns {*}
|
|
|
|
*/
|
|
|
|
setPerformanceCollectionEnabled(enabled: boolean) {
|
2017-06-30 16:23:32 +00:00
|
|
|
return this._native.setPerformanceCollectionEnabled(enabled);
|
2017-05-25 07:41:43 +00:00
|
|
|
}
|
|
|
|
|
2017-05-24 11:37:52 +00:00
|
|
|
/**
|
|
|
|
* Returns a new trace instance
|
|
|
|
* @param trace
|
|
|
|
*/
|
|
|
|
newTrace(trace: string): void {
|
|
|
|
return new Trace(this, trace);
|
|
|
|
}
|
|
|
|
}
|