jmesserly / dart-custom-element-demo

Example of a custom element written in Dart, using JS interop for registration
MIT License
21 stars 4 forks source link

Dart2JS support #3

Open elmcrest opened 5 years ago

elmcrest commented 5 years ago

Hey,

first of all thx for the example, it does work for me with DDC which is nice.

But I'd also need dart2js support and while dart2js seems to compile your example, I'll get a runtime error right after loading index.html.

I just did dart2js main.dart to compile it and used the out.js file.

error message in the console is:

main.dart:47 Uncaught TypeError: self.defineElement is not a function
    at Object.dart.main (main.dart:47)
    at sort.dart:342
    at sort.dart:342
    at sort.dart:342
    at sort.dart:342

any Ideas if there's a solution to this?

donny-dont commented 5 years ago

It doesn't currently work in dart2js. There needs to be some stuff done to dart2js to support things.

See the larger conversation in https://github.com/jmesserly/dart-custom-element-demo/pull/2