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

31 lines
681 B
JavaScript
Raw Normal View History

2017-05-24 11:37:52 +00:00
// @flow
import { NativeModules } from 'react-native';
2017-05-24 11:37:52 +00:00
import { Base } from './../base';
import Trace from './Trace';
const FirebasePerformance = NativeModules.RNFirebasePerformance;
2017-05-24 11:37:52 +00:00
export default class PerformanceMonitoring extends Base {
/**
* 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';
}
}