nativescript-plugin-firebase-updated
Version:
28 lines (27 loc) • 797 B
JavaScript
import { firebaseUtils } from "../utils";
export function startTrace(name) {
return new FirebaseTrace(FIRPerformance.startTraceWithName(name));
}
export class FirebaseTrace {
constructor(nativeTrace) {
this.nativeTrace = nativeTrace;
}
setValue(attribute, value) {
this.nativeTrace.setValueForAttribute(value, attribute);
}
getValue(attribute) {
return this.nativeTrace.valueForAttribute(attribute);
}
getAttributes() {
return firebaseUtils.toJsObject(this.nativeTrace.attributes);
}
removeAttribute(attribute) {
this.nativeTrace.removeAttribute(attribute);
}
incrementMetric(metric, by) {
this.nativeTrace.incrementMetricByInt(metric, by);
}
stop() {
this.nativeTrace.stop();
}
}