polymer-dart icon indicating copy to clipboard operation
polymer-dart copied to clipboard

Dart Polymer element + dart2js: let me import into a Polymer JS project

Open DartBot opened this issue 9 years ago • 13 comments

<img src="https://avatars.githubusercontent.com/u/17034?v=3" align="left" width="96" height="96"hspace="10"> Issue by kevmoo Originally opened as dart-lang/sdk#15227


No clue if this is practical, but it'd be great.

  1. Create polymer element with foo.dart + foo.html
  2. dart2js to foo.js
  3. Deploy foo.html + foo.js ... somewhere
  4. Polymer JS app can <link rel="import" href="foo.html">
  5. It works!

DartBot avatar Jun 05 '15 23:06 DartBot

<img src="https://avatars.githubusercontent.com/u/1081711?v=3" align="left" width="48" height="48"hspace="10"> Comment by jmesserly


so it will work now, but might not give you the result you expect. :)

two issues:

  1. dart2js output will be very large. I'd guess at least ~400k minified. But it will grow slowly for each added widget, so might be okay for a really big widget library compiled together.
  2. you'll need JS -> Dart interop to talk to the Dart element. I don't know how that is accomplished but Justin probably does.

So it works but ... is probably not usable in practice.

Not sure how to proceed, due to issue dart-lang/sdk#1 above. Open to suggestions...


cc @justinfagnani. cc @dgrove. Added NeedsInfo label.

DartBot avatar Jun 05 '15 23:06 DartBot

<img src="https://avatars.githubusercontent.com/u/1206632?v=3" align="left" width="48" height="48"hspace="10"> Comment by a14n


(Divagating and assuming I never dive into dart2js) For issue dart-lang/sdk#1 it would be interesting if dart2js could create a js file containing the bases for Dart + polymer runtime emulation. This file could be imported in the generated polymer-element (with <link tel="import" src="dart-polymer-base.html"> or something like that) and shared between dart polymer-elements. The polymer-element would thus contain only a limited js file that would be based on. It looks like the deferred loading. I really don't know if this is possible. What do you think ?

DartBot avatar Jun 05 '15 23:06 DartBot

<img src="https://avatars.githubusercontent.com/u/1081711?v=3" align="left" width="48" height="48"hspace="10"> Comment by jmesserly


Removed Area-Polymer label. Added area-pkg, Pkg-Polymer labels.

DartBot avatar Jun 05 '15 23:06 DartBot

<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch


Removed Priority-Unassigned label. Added Priority-Medium label.

DartBot avatar Jun 05 '15 23:06 DartBot

<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch


Removed Polymer-P-2 label. Added Polymer-Milestone-Later label.

DartBot avatar Jun 05 '15 23:06 DartBot

<img src="https://avatars.githubusercontent.com/u/2049220?v=3" align="left" width="48" height="48"hspace="10"> Comment by sigmundch


Removed Polymer-Milestone-Later label. Added PolymerMilestone-Later label.

DartBot avatar Jun 05 '15 23:06 DartBot