cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Homer, Tony" <tony.ho...@intel.com>
Subject Re: Doing some late night work, and I found this
Date Wed, 27 Jan 2016 14:23:28 GMT
Pretty exciting! Definitely seems like it would be cleaner.
Do you think this would be a new bridge mode?

I spent a couple minutes trying to find an example of how to use this, but didn't come up
with anything outside of the docs.

Looks like the relevant classes are WebMessage, WebMessagePort and WebView.
The relevant methods on WebView are createWebMessageChannel[1] and postWebMessage[2].
createWebMessageChannel returns an array of 2 WebMessagePorts.
I don't quite get how it works - how does the JS side know what port to use?
The WebMessagePort overview [3] talks about transferring a port to JS - what does that mean?

I'll come back to this later and re-read the docs.
Thanks for bringing this up, Joe!


[1] http://developer.android.com/reference/android/webkit/WebView.html#createWebMessageChannel()
[2] http://developer.android.com/reference/android/webkit/WebView.html#postWebMessage(android.webkit.WebMessage,
android.net.Uri)
[3] http://developer.android.com/reference/android/webkit/WebMessagePort.html


On 1/27/16, 1:10 AM, "Joe Bowser" <bowserj@gmail.com> wrote:

>http://developer.android.com/reference/android/webkit/WebMessage.html
>
>I'm curious as to how this works in comparison to our current method of
>passing something back from native to the browser and whether this would be
>faster/cleaner.  This would be Android WebView specific, and only would
>work on API Level 23, but it's interesting.
>
>Thoughts?
Mime
View raw message