You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.
It seems like in order to allow seamless consumption of elements written in JavaScript, there needs to be a way to register unknown JavaScript types so that they are converted to Dart objects. There's probably a relationship here to custom-element-apigen too.
The text was updated successfully, but these errors were encountered:
Correct. If users can register type mappings for any JsObject, then on the Dart side, anything that can comes out of Polymer can be converted to a Dart object instead of JsObject. If this is done when someone wraps a JavaScript element in custom-element-apigen, then no-one who uses that element should have to know it's a not natively Dart. I think :)
Here's an example of what this case should look like like with the new JS interop.
There is no proxying or wrapping. Essentially you define JavaScript interfaces specifying the shape of the JavaScript API you want to access from Dart and then you can access that interface on any JavaScript object passed to Dart where DOM objects are considered JavaScript objects.
import'package:js/js.dart';
@JsclassAwesomeCustomElement {
// all methods must be external.externalsomeAwesomeMethod(foo);
externalStringget someAwesomeGetter;
}
voidmain() {
AwesomeCustomElement element =querySelector("#yourElementId");
element.someAwesomeMethod("hello");
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It seems like in order to allow seamless consumption of elements written in JavaScript, there needs to be a way to register unknown JavaScript types so that they are converted to Dart objects. There's probably a relationship here to custom-element-apigen too.
The text was updated successfully, but these errors were encountered: