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

32 lines
720 B
JavaScript
Raw Normal View History

2017-05-24 11:37:52 +00:00
// @flow
import Trace from './Trace';
import ModuleBase from '../../utils/ModuleBase';
2017-05-24 11:37:52 +00:00
export default class PerformanceMonitoring extends ModuleBase {
static _NAMESPACE = 'perf';
static _NATIVE_MODULE = 'RNFirebasePerformance';
_native: Object;
constructor(firebaseApp: Object, options: Object = {}) {
super(firebaseApp, options);
}
2017-05-24 11:37:52 +00:00
/**
* Globally enable or disable performance monitoring
* @param enabled
* @returns {*}
*/
setPerformanceCollectionEnabled(enabled: boolean) {
return this._native.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);
}
}