Skip to content
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

Introspecting js proxy object of js map -> dart Map #12997

Closed
DartBot opened this issue Sep 3, 2013 · 6 comments
Closed

Introspecting js proxy object of js map -> dart Map #12997

DartBot opened this issue Sep 3, 2013 · 6 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant library-js type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Sep 3, 2013

This issue was originally filed by bendera...@google.com


Often when working with js apis like chrome.* in a chrome extension it is necessary to convert from a js Map/Object to a dart Map. Currently there isn't an easy way to do so which makes it hard to know what has been returned or to convert a js map into a typed dart object. I have managed to get a solution working using js.context.Objects.keys but it seems like this is functionality that should be provided by jsinterop to compliment js.map().

@DartBot
Copy link
Author

DartBot commented Sep 3, 2013

This comment was originally written by @a14n


You can have a look at JsObjectToMapAdapter ( https://github.com/dart-lang/js-interop/blob/master/lib/src/wrapping/js/object_to_map_adapter.dart and https://github.com/dart-lang/js-interop/blob/master/test/js_wrapping/browser_tests.dart#L322). It will allow to handle a proxy like a Map :

  Map<String, dynamic> map = new JsObjectToMapAdapter.fromProxy(myProxy);

In dart:js there's nothing like this for now ( if https://chromiumcodereview.appspot.com/23291005/ goes in you will be able to use : myJsObject.asDartMap() to get a Map )

@DartBot
Copy link
Author

DartBot commented Sep 3, 2013

This comment was originally written by bendera...@google.com


Oh I had not found the adapter, is it in the interop docs somewhere? I should be able to get away with this for now.

@DartBot
Copy link
Author

DartBot commented Sep 3, 2013

This comment was originally written by @a14n


There's no doc on js_wrapping for now ( a pull-request is waiting for a lgtm - dart-archive/js-interop-deprecated#103 )

@larsbak
Copy link

larsbak commented Sep 4, 2013

Added Area-Library, Triaged labels.

@floitschG
Copy link
Contributor

Removed Type-Defect label.
Added Type-Enhancement, Library-JS labels.

@justinfagnani
Copy link
Contributor

We'll be adding a similar adapter for dart:js JsObject as well.


Set owner to @justinfagnani.
Added Accepted label.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-js labels Oct 30, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed priority-unassigned labels Feb 29, 2016
@matanlurey matanlurey added the closed-obsolete Closed as the reported issue is no longer relevant label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-obsolete Closed as the reported issue is no longer relevant library-js type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants