You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I basically trying to write a interop for the ga function of google analytics.
The problem is that it is not only a function, but also exposes properties (l and q).
The following code, actually runs, and sends pageview events to google analytics. The only way to make the analyzer happy is add a call method. However, if I do that, dart2js breaks.
So basically, this codes works fine, but I just want to silence the analyzer.
import 'package:js/js.dart';
@JS('ga')
external Ga get ga;
@JS('ga')
class Ga {
external int get l;
external set l(int l);
external List get q;
external set q(List q);
}
class Analytics {
Analytics(String trackingNumber) {
ga.l = new DateTime.now().millisecondsSinceEpoch;
ga('create', trackingNumber, 'auto');
}
send(String event) {
ga('send', event);
}
}
The text was updated successfully, but these errors were encountered:
I have a CL in progress that will fix this. Adding a call method to A js interop class isn't supposed to break dart2js. You will also want to make class Ga implement Function as is the convention for classes with a call method.
So I basically trying to write a interop for the
ga
function of google analytics.The problem is that it is not only a function, but also exposes properties (
l
andq
).The following code, actually runs, and sends pageview events to google analytics. The only way to make the analyzer happy is add a
call
method. However, if I do that, dart2js breaks.So basically, this codes works fine, but I just want to silence the analyzer.
The text was updated successfully, but these errors were encountered: