all files / firebase/modules/perf/ index.js

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42                                                                       
/**
 * @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 = {};