MCPcopy Create free account
hub / github.com/NativeScript/firebase / Performance

Class Performance

packages/firebase-performance/index.android.ts:114–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114export class Performance implements IPerformance {
115 _native: com.google.firebase.perf.FirebasePerformance;
116 _app: FirebaseApp;
117
118 constructor() {
119 if (defaultPerformance) {
120 return defaultPerformance;
121 }
122 defaultPerformance = this;
123 this._native = com.google.firebase.perf.FirebasePerformance.getInstance();
124 }
125
126 get isPerformanceCollectionEnabled(): boolean {
127 return this.native.isPerformanceCollectionEnabled();
128 }
129
130 set isPerformanceCollectionEnabled(value) {
131 this.native.setPerformanceCollectionEnabled(value);
132 }
133
134 newHttpMetric(url: string, httpMethod: HttpMethod): HttpMetric {
135 return HttpMetric.fromNative(this.native.newHttpMetric(url, httpMethod));
136 }
137 newTrace(identifier: string): Trace {
138 return Trace.fromNative(this.native.newTrace(identifier));
139 }
140
141 startTrace(identifier: string): Trace {
142 const trace = this.newTrace(identifier);
143 trace.start();
144 return trace;
145 }
146
147 get native() {
148 return this._native;
149 }
150 get android() {
151 return this.native;
152 }
153
154 get app(): FirebaseApp {
155 if (!this._app) {
156 // @ts-ignore
157 this._app = FirebaseApp.fromNative(this.native.app);
158 }
159 return this._app;
160 }
161}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected