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

37 lines
844 B
JavaScript
Raw Normal View History

/**
* @flow
* Performance monitoring representation wrapper
*/
2017-05-24 11:37:52 +00:00
import Trace from './Trace';
import ModuleBase from '../../utils/ModuleBase';
2017-05-24 11:37:52 +00:00
import type FirebaseApp from '../core/firebase-app';
export default class PerformanceMonitoring extends ModuleBase {
static _NAMESPACE = 'perf';
static _NATIVE_MODULE = 'RNFirebasePerformance';
constructor(firebaseApp: FirebaseApp, 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): void {
this._native.setPerformanceCollectionEnabled(enabled);
}
2017-05-24 11:37:52 +00:00
/**
* Returns a new trace instance
* @param trace
*/
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 = {};