2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
+ import 'dart:js_interop' ;
6
+
5
7
import 'package:firebase_core_web/firebase_core_web_interop.dart' hide jsify;
6
8
7
9
import 'performance_interop.dart' as performance_interop;
@@ -38,45 +40,46 @@ class Performance
38
40
: super .fromJsObject (jsObject);
39
41
40
42
Trace trace (String traceName) =>
41
- Trace .fromJsObject (performance_interop.trace (jsObject, traceName));
43
+ Trace .fromJsObject (performance_interop.trace (jsObject, traceName.toJS ));
42
44
43
45
/// Non-null App for this instance of firestore service.
44
46
App get app => App .getInstance (jsObject.app);
45
47
46
- bool get instrumentationEnabled => jsObject.instrumentationEnabled;
47
- bool get dataCollectionEnabled => jsObject.dataCollectionEnabled;
48
+ bool get instrumentationEnabled => jsObject.instrumentationEnabled.toDart ;
49
+ bool get dataCollectionEnabled => jsObject.dataCollectionEnabled.toDart ;
48
50
}
49
51
50
52
class Trace extends JsObjectWrapper <performance_interop.TraceJsImpl > {
51
53
Trace .fromJsObject (performance_interop.TraceJsImpl jsObject)
52
54
: super .fromJsObject (jsObject);
53
55
54
- String getAttribute (String attr) => jsObject.getAttribute (attr) ;
56
+ String getAttribute (String attr) => jsObject.getAttribute (attr.toJS).toDart ;
55
57
56
58
Map <String , String > getAttributes () {
57
59
return dartify (jsObject.getAttributes ()).cast <String , String >();
58
60
}
59
61
60
- int getMetric (String metricName) => jsObject.getMetric (metricName);
62
+ int getMetric (String metricName) =>
63
+ jsObject.getMetric (metricName.toJS).toDartInt;
61
64
62
65
void incrementMetric (String metricName, [int ? num ]) {
63
66
if (num != null ) {
64
- return jsObject.incrementMetric (metricName, num );
67
+ return jsObject.incrementMetric (metricName.toJS , num .toJS );
65
68
} else {
66
- return jsObject.incrementMetric (metricName);
69
+ return jsObject.incrementMetric (metricName.toJS );
67
70
}
68
71
}
69
72
70
73
void putMetric (String metricName, int num ) {
71
- return jsObject.putMetric (metricName, num );
74
+ return jsObject.putMetric (metricName.toJS , num .toJS );
72
75
}
73
76
74
77
void putAttribute (String attr, String value) {
75
- return jsObject.putAttribute (attr, value);
78
+ return jsObject.putAttribute (attr.toJS , value.toJS );
76
79
}
77
80
78
81
void removeAttribute (String attr) {
79
- return jsObject.removeAttribute (attr);
82
+ return jsObject.removeAttribute (attr.toJS );
80
83
}
81
84
82
85
void start () {
@@ -97,8 +100,8 @@ class PerformanceSettings
97
100
bool ? instrumentationEnabled,
98
101
]) {
99
102
final jsObject = performance_interop.PerformanceSettingsJsImpl (
100
- dataCollectionEnabled: dataCollectionEnabled,
101
- instrumentationEnabled: instrumentationEnabled,
103
+ dataCollectionEnabled: dataCollectionEnabled? .toJS ,
104
+ instrumentationEnabled: instrumentationEnabled? .toJS ,
102
105
);
103
106
return _expando[jsObject] ?? = PerformanceSettings ._fromJsObject (jsObject);
104
107
}
@@ -107,13 +110,13 @@ class PerformanceSettings
107
110
performance_interop.PerformanceSettingsJsImpl jsObject,
108
111
) : super .fromJsObject (jsObject);
109
112
110
- bool ? get dataCollectionEnabled => jsObject.dataCollectionEnabled;
113
+ bool ? get dataCollectionEnabled => jsObject.dataCollectionEnabled? .toDart ;
111
114
set dataCollectionEnabled (bool ? b) {
112
- jsObject.dataCollectionEnabled = b;
115
+ jsObject.dataCollectionEnabled = b? .toJS ;
113
116
}
114
117
115
- bool ? get instrumentationEnabled => jsObject.instrumentationEnabled;
118
+ bool ? get instrumentationEnabled => jsObject.instrumentationEnabled? .toDart ;
116
119
set instrumentationEnabled (bool ? b) {
117
- jsObject.instrumentationEnabled = b;
120
+ jsObject.instrumentationEnabled = b? .toJS ;
118
121
}
119
122
}
0 commit comments