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

42 lines
930 B
JavaScript

/**
* @flow
* Performance monitoring representation wrapper
*/
import Trace from './Trace';
import ModuleBase from '../../utils/ModuleBase';
import { getNativeModule } from '../../utils/native';
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,
});
}
/**
* Globally enable or disable performance monitoring
* @param enabled
* @returns {*}
*/
setPerformanceCollectionEnabled(enabled: boolean): void {
getNativeModule(this).setPerformanceCollectionEnabled(enabled);
}
/**
* Returns a new trace instance
* @param trace
*/
newTrace(trace: string): Trace {
return new Trace(this, trace);
}
}
export const statics = {};