Skip to content

js interop works, but analyzer doesn't like it #25321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kasperpeulen opened this issue Dec 29, 2015 · 3 comments
Closed

js interop works, but analyzer doesn't like it #25321

kasperpeulen opened this issue Dec 29, 2015 · 3 comments
Assignees
Labels
web-js-interop Issues that impact all js interop

Comments

@kasperpeulen
Copy link

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);
  }
}

@jacob314 jacob314 self-assigned this Dec 29, 2015
@jacob314 jacob314 added this to the 1.14 milestone Dec 29, 2015
@jacob314
Copy link
Member

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.

@kevmoo kevmoo added the web-js-interop Issues that impact all js interop label Dec 29, 2015
@kevmoo kevmoo modified the milestones: 1.14, 1.15 Jan 14, 2016
@mit-mit
Copy link
Member

mit-mit commented Mar 2, 2016

Clearing out 1.15 milestone as the last full push to dev has happened. If any changes are required before 1.15 is shipped, please file a merge request

@mit-mit mit-mit modified the milestones: 1.16, 1.15 Mar 2, 2016
@kevmoo kevmoo removed this from the 1.16 milestone Apr 19, 2016
@jacob314 jacob314 mentioned this issue Jul 8, 2016
19 tasks
@jacob314
Copy link
Member

Fixed by
bbb0c3f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-js-interop Issues that impact all js interop
Projects
None yet
Development

No branches or pull requests

4 participants