42 lines
939 B
JavaScript
42 lines
939 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/firebase-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 = {};
|