2017-12-04 12:07:41 +00:00
|
|
|
/**
|
|
|
|
* @flow
|
|
|
|
* Performance monitoring representation wrapper
|
|
|
|
*/
|
2017-05-24 11:37:52 +00:00
|
|
|
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-12-04 12:07:41 +00:00
|
|
|
import type FirebaseApp from '../core/firebase-app';
|
|
|
|
|
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-12-04 12:07:41 +00:00
|
|
|
constructor(firebaseApp: FirebaseApp, 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 {*}
|
|
|
|
*/
|
2017-12-04 12:07:41 +00:00
|
|
|
setPerformanceCollectionEnabled(enabled: boolean): void {
|
|
|
|
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
|
|
|
|
*/
|
2017-12-04 12:07:41 +00:00
|
|
|
newTrace(trace: string): Trace {
|
2017-05-24 11:37:52 +00:00
|
|
|
return new Trace(this, trace);
|
|
|
|
}
|
|
|
|
}
|
2017-11-23 17:29:40 +00:00
|
|
|
|
|
|
|
export const statics = {};
|