-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow @JS on class method #24779
Comments
you need a custom interceptor to support custom names for individual member methods. We will provide a general scheme to expose js private methods and cases where the JS name is not accessible from Dart. The common use case would be methods with illegal dart names. For example if you ever need to actually access the js method JS$Foo you would have to write JS$JS$Foo to escape. |
@jacob314 should this be closed? Or do you want to keep it as a place-holder for other work? |
@jacob314 could you explain how those |
The main key is there needs to be a single consistent mapping across all JS methods named you would get in trouble if you have and On Thu, Nov 5, 2015 at 12:56 AM, Alexandre Ardhuin <notifications@github.com
|
Reassigning and changing the area as this is really a dart2.0 language feature request. |
Awesome !!! Is there also a feature request to allow non external method in |
If it happened to be implemented with extension methods than you could essentially add arbitrary non-external methods to @js classes as long as the type is statically known at invocation time. |
Can you give some more details on what the language-level request is for this? |
Does the death of Dartium and the soundness changes in Dart 2 change something to this issue ? It would be really awesome to have this feature to provide darty libs on top of JS libs. |
Dart2Js needs to start taking advantage of the Dart 2 type system and then this feature is feasible. |
Not sure that it's covered by this issue but does having concrete methods in a @JS('google.maps.Map')
class Map {
LatLngBounds get bounds => _getBounds();
@JS('getBounds') LatLngBounds _getBounds();
} |
Yes. I believe if you have one feature the other feature is pretty easy to implement. |
Is this still a language request? If so, what's the request? Something like extension methods? |
This is a request to improve JS-interop. As Dartium is now dead I think this can be implemented directly in JS backends. So I don't think extension methods are still needed. Someone let me know that some JS-interop improvements were on the road. Any news about that and what to expect? |
this is important to address as part of improving JS interop (#35084) |
I think https://dart-review.googlesource.com/c/sdk/+/88020 was intended to solve this. Unfortunately we're blocked on moving forward unless we can also solve it in dart2js which is more difficult. Nothing will change for now. |
This is now supported as part of the new interop based on |
Unlike top level function putting
@JS
on a class method has no effect.A use case where it is needed is to make a Js member named
_m1()
onA
be used outside of the current dart library.I'd like to be able to have:
The text was updated successfully, but these errors were encountered: