Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

JsName and other metadata needs to live somewhere #135

Closed
jmesserly opened this issue Apr 15, 2015 · 8 comments
Closed

JsName and other metadata needs to live somewhere #135

jmesserly opened this issue Apr 15, 2015 · 8 comments

Comments

@jmesserly
Copy link
Contributor

Either in a package or in a SDK library.

import 'what_the_heck_do_I_write_here' show JsName;

@JsName('HTMLAwesomeElement')
class AwesomeElement extends HTMLElement { ... }
@jmesserly
Copy link
Contributor Author

the most obvious place to put it now would be package:dev_compiler. It's a place, that we can add to, and works for testing/examples until we find something better.

[edit: emphasis]

@jmesserly
Copy link
Contributor Author

Otherwise, everyone needs to copy+paste JsName, that seems bad right?

@jmesserly jmesserly added the js label Apr 15, 2015
@jmesserly
Copy link
Contributor Author

dart:js might probably the right place once it's stable. Or just skip it and use package:js, since not sure it would need to be in dart:

@jacob314
Copy link
Contributor

dart:js seems pretty reasonable although I can also see the case for
package:js/annotations.dart
or even
package:dev_compiler
although I dislike that option as I expect these annotations will be consumed by code generators other than dev_compiler in the future.

@jmesserly
Copy link
Contributor Author

although I dislike that option as I expect these annotations will be consumed by code generators other than dev_compiler in the future.

agreed, dev_compiler would be a temporary place.

@ochafik
Copy link
Contributor

ochafik commented Oct 29, 2015

Noobie question: can we use the annotation before the import and still get the right element?

@JsName(name = 'window')
library dom;

import 'package:js/src/internal.dart' show JsName;

(here the annotation seems to have a type which lib is dom :-S)

@jacob314
Copy link
Contributor

Yep you can use the annotation before the import. We rely on that all the
time for the
@js annotation.

On Thu, Oct 29, 2015 at 9:13 AM, Olivier Chafik [email protected]
wrote:

Noobie question: can we use the annotation before the import and still get
the right element?

@JsName(name = 'window')
library dom;

import 'package:js/src/internal.dart' show JsName;

(here the annotation seems to have a type which lib is dom :-S)


Reply to this email directly or view it on GitHub
#135 (comment)
.

ochafik pushed a commit that referenced this issue Oct 29, 2015
Note: need new package:js release before merging this in (dart-lang/sdk#24623). Maybe it's time to think again about sneaking JsName + JsPeerInterface into it? (#135)

BUG=#310
[email protected]

Review URL: https://codereview.chromium.org/1424133007 .
@jmesserly
Copy link
Contributor Author

Think the work here is done. Annotations found a good home.

nex3 pushed a commit to dart-lang/sdk that referenced this issue Aug 31, 2016
Note: need new package:js release before merging this in (#24623). Maybe it's time to think again about sneaking JsName + JsPeerInterface into it? (dart-archive/dev_compiler#135)

BUG=dart-archive/dev_compiler#310
[email protected]

Review URL: https://codereview.chromium.org/1424133007 .
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants