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

42 lines
930 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';
import { getNativeModule } from '../../utils/native';
2017-05-24 11:37:52 +00:00
import type App from '../core/app';
export const MODULE_NAME = 'RNFirebasePerformance';
export const NAMESPACE = 'perf';
export default class PerformanceMonitoring extends ModuleBase {
constructor(app: App) {
super(app, {
moduleName: MODULE_NAME,
multiApp: false,
namespace: NAMESPACE,
});
}
2017-05-24 11:37:52 +00:00
/**
* Globally enable or disable performance monitoring
* @param enabled
* @returns {*}
*/
setPerformanceCollectionEnabled(enabled: boolean): void {
getNativeModule(this).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 = {};