NO-STATUS
This example demonstrates sending messages from JavaScript to the Native Client module, and from the Native Client module to JavaScript.
There are two ways to do this: asynchronously and sychronously.
postMessage()
sends a message from JavaScript to the module
asynchronously. This means that the response must be handled in a callback.
postMessageAndAwaitResponse()
sends a message synchronously.
JavaScript execution is blocked while the module generates and sends back
a response. The response from the module is returned from the call to
postMessageAndAwaitResponse()
, so no callback is necessary.
Take a look at example.js
to see the difference between these
two methods.