I don't want to wait anymore and would like to use a polymer element written in dart right away.
The problem is that I want to use it in an already existing app, that's running on JavaScript.
Can I just compile my polymer elements to JavaScript, include the whole thing in my current app, and use my <awesome-element> tags?
No, you have to build a Dart app to use Dart Polymer elements.
You can include JavaScript in a Dart/PolymerDart application.
Related
I need to create a multi-platform app for web, ios, android and partially desktop.
I wish to use .NET/F#, but the UI is a complication. I have tried Xamarin.Forms and it is too limited to me. I could live to use React Native but I don't wanna to code the full app in javascript, instead, I wish to use F# for all the logic and web backend, and use react only for the UI in mobile.
But I wonder how?
How feed data to the UI and react to events there?
P.D: If nativescript make this possible I'm all ears. I'm still not rule out xamarin for it, but forms is too limited and the nature of the apps and so far think react native is the closer to my needs.
There's already a sample of this, because the entry file of the Fable React Native demo is a pure JS file that calls the JS generated by Fable. You just need to extend this pure JS layer and import the code generated by Fable when needed.
I'm building up some Dart code that I would like to use in an app where it is essentially a library to the javascript. I'm wondering how I can specify which Dart files I'd like in the project to be part of the library. For example, theres Foo.dart and Bar.dart. How can I have the created product include both Foo.dart and Bar.dart in one file? I'm also concerned about tree shaking since none of the classes are instantiated in Dart.
There's also a Baz.dart, and I would like to have a different build for compiling Foo.dart and Baz.dart into a single file (though this is less important, as I can accomplish this would separate projects and some symlinking).
Thanks!
This use case (build a JavaScript library with Dart) isn't supported yet.
The reworked js-interop package is supposed to allow to do that but I don't know about it's current state.
So I found this nice port of Chart.js as a polymer component on customelements.io but I'm not able to use them in my polymer.dart project. I copied all the files from the library project into my project and fixed the paths but the elements are not showing up. I get
Uncaught ReferenceError: Polymer is not defined chart-bar.html:27(anonymous function) chart-bar.html:27
(+ same error for the other files from the library proj).
I have no bower.json in my project (but a pubspec.yaml) and I'm wondering if I need one because the library project got one in there?
So what is the right way to get those polymer elements into my project?
There is currently no straight-forward way to use Polymer.js polymer elements in a Polymer.dart project.
You can try to generate Dart wrappers using https://github.com/dart-lang/custom-element-apigen / https://pub.dartlang.org/search?q=custom-element-apigen.
The code generation depends on proper JavaScript codedoc in the JS elements which is often incomplete but I have heard of people who were satisfied by the result (Dart core_elements/paper_elements are generated with this but there is also manual work involved).
I am curious to know if its possible to have Asynchronous module definition with Angular.dart (or dart in general), if yes, then please share a sample code for such a single page application.
AMD is made largely irrelevant by the fact that Dart comes with a complete module system that is built into the language. That is the purpose of the import statement. Dart files are dynamically loaded in Dartium. If you are using the darttojs transpiler, it will create a single large file. The solution to this is to use use the DeferredLibrary class which will cause darttojs to create separate javascript files for each annotated import
See Seth Ladd's blog post for more details.
Is there a way to use existing Polymer standard core elements , such as core-toolbar and core-menu, in Dart?
If you download the polymer project with bower you can find the javascript versions in /polymer/bower-components/.
core-toolbar, for instance, contains a core-toolbar.html and a metadata.html. These have <polymer-element> tags in them just like in Dart. Can these be adapted?
In the meantime, an official package has arrived:
http://pub.dartlang.org/packages/core_elements
And you can even have the paper elements of the material design:
http://pub.dartlang.org/packages/paper_elements
I found this issues:
https://code.google.com/p/dart/issues/detail?id=14098
This is not the post I talked about in my comment.
https://code.google.com/p/dart/issues/detail?id=13758
The linked discussion in this issue could be the post I remembered
the TodoMVC is a Dart demo project (https://www.dartlang.org/samples/) that uses some Polymer.js polymer_elements
see source in lib-elements directory
As mentioned in my comment alternatively you could use the Dart port of polymer_elements and polymer_ui_elements
https://github.com/ErikGrimes/polymer_elements
https://github.com/ErikGrimes/polymer_ui_elements