2017-05-24 11:37:52 +00:00
|
|
|
// @flow
|
2017-05-25 07:41:43 +00:00
|
|
|
import { NativeModules } from 'react-native';
|
2017-05-24 11:37:52 +00:00
|
|
|
import { Base } from './../base';
|
|
|
|
import Trace from './Trace';
|
|
|
|
|
2017-05-25 07:41:43 +00:00
|
|
|
const FirebasePerformance = NativeModules.RNFirebasePerformance;
|
|
|
|
|
2017-05-24 11:37:52 +00:00
|
|
|
export default class PerformanceMonitoring extends Base {
|
|
|
|
|
2017-05-25 07:41:43 +00:00
|
|
|
/**
|
|
|
|
* Globally enable or disable performance monitoring
|
|
|
|
* @param enabled
|
|
|
|
* @returns {*}
|
|
|
|
*/
|
|
|
|
setPerformanceCollectionEnabled(enabled: boolean) {
|
|
|
|
return FirebasePerformance.setPerformanceCollectionEnabled(enabled);
|
|
|
|
}
|
|
|
|
|
2017-05-24 11:37:52 +00:00
|
|
|
/**
|
|
|
|
* Returns a new trace instance
|
|
|
|
* @param trace
|
|
|
|
*/
|
|
|
|
newTrace(trace: string): void {
|
|
|
|
return new Trace(this, trace);
|
|
|
|
}
|
|
|
|
|
|
|
|
get namespace(): string {
|
|
|
|
return 'firebase:perf';
|
|
|
|
}
|
|
|
|
}
|