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

Ensure evalAsync behaves the same across platforms #6

Open
1 of 3 tasks
jonatansberg opened this issue Feb 18, 2015 · 0 comments
Open
1 of 3 tasks

Ensure evalAsync behaves the same across platforms #6

jonatansberg opened this issue Feb 18, 2015 · 0 comments

Comments

@jonatansberg
Copy link
Contributor

Background

The behavior of evalAsync differ between platforms. In order for things to work cross platform you need to wrap your call in an IIFE and make sure to skip the final semicolon.

webView.evalAsync('(function(){ return { some: "object" }; })()', function (res) {
  var obj = res && JSON.parse(res);
});

Todo

  • Return JSON strings on iOS (instead of just freaking out for non string values)
  • Handle calls that are not wrapped in functions on Android
  • Be tolerant of syntax stuff (i.e. trailing semicolons)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant