suppose I want to create a wrapper for a javascript API such as localStorage that adds some additional functionality like automatically journaling changes and syncing it to a server. Dart already has wrappers for these APIs, what is a good way to create a dart wrapper for my wrapped API?
To run in mainstream web browsers, Dart relies on a source-to-source compiler to JavaScript.
This library provides access to JavaScript objects from Dart, allowing Dart code to get and set properties, and call methods of JavaScript objects and invoke JavaScript functions. The library takes care of converting between Dart and JavaScript objects where possible, or providing proxies if conversion isn't possible.
You can use the Proxy class for this. There is a good article explaining how this works at http://www.dartlang.org/articles/js-dart-interop/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With