| 132 | } |
| 133 | |
| 134 | export class Performance implements IPerformance { |
| 135 | _native: FIRPerformance; |
| 136 | _app: FirebaseApp; |
| 137 | |
| 138 | constructor() { |
| 139 | if (defaultPerformance) { |
| 140 | return defaultPerformance; |
| 141 | } |
| 142 | defaultPerformance = this; |
| 143 | this._native = FIRPerformance.sharedInstance(); |
| 144 | } |
| 145 | |
| 146 | get isPerformanceCollectionEnabled(): boolean { |
| 147 | return this.native.dataCollectionEnabled; |
| 148 | } |
| 149 | |
| 150 | set isPerformanceCollectionEnabled(value) { |
| 151 | this.native.dataCollectionEnabled = value; |
| 152 | this.native.instrumentationEnabled = value; |
| 153 | } |
| 154 | |
| 155 | newHttpMetric(url: string, httpMethod: HttpMethod): HttpMetric { |
| 156 | return HttpMetric.fromUrlMethod(url, httpMethod); |
| 157 | } |
| 158 | newTrace(identifier: string): Trace { |
| 159 | return Trace.fromNative(this.native.traceWithName(identifier)); |
| 160 | } |
| 161 | |
| 162 | startTrace(identifier: string): Trace { |
| 163 | const trace = Trace.fromNative(this.native.traceWithName(identifier)); |
| 164 | trace.start(); |
| 165 | return trace; |
| 166 | } |
| 167 | |
| 168 | get native() { |
| 169 | return this._native; |
| 170 | } |
| 171 | get ios() { |
| 172 | return this.native; |
| 173 | } |
| 174 | |
| 175 | get app(): FirebaseApp { |
| 176 | if (!this._app) { |
| 177 | // @ts-ignore |
| 178 | this._app = FirebaseApp.fromNative(this.native.app); |
| 179 | } |
| 180 | return this._app; |
| 181 | } |
| 182 | } |
nothing calls this directly
no outgoing calls
no test coverage detected