IWebViewJavascriptMessage EventAwesomium.NET 1.7.6Awesomium.NET

Namespace: Awesomium.Core
Assembly: Awesomium.Core (in Awesomium.Core.dll) Version:

event JavascriptMessageEventHandler JavascriptMessage


Type: Awesomium.CoreJavascriptMessageEventHandler

sendMessage(String, Any) and the asynchronous sendMessageAsync(String, Function, Any), can be used instead of creating and binding to custom methods of a global JavaScript object created with CreateGlobalJavascriptObject(String).

Unlike regular synchronous custom JavaScript methods created by the managed application through Bind Overload or using the Dynamic Language Runtime (DLR), sendMessage(String, Any) allows callers to pass JavaScript objects to the Arguments array, even though the method is called synchronously (see Synchronous & Asynchronous API).

JavaScript objects passed to Arguments are being serialized, any function members (methods) are stripped out and they are deserialized to the hosting application as local JSObjects. Nevertheless, the objects are still passed by reference. Any changes applied to passed objects in the handler of a JavascriptMessage event, will be reflected back to the original remote instances when sendMessage(String, Any) returns.

Note Note
Function members (methods) of objects passed to Arguments, are being stripped out when the object is passed to the hosting application (calling them from the hosting application would cause a deadlock). However this does not affect the original client-side instances.
Caution note Caution
JavaScript objects passed to Arguments, are serialized and deserialized using JSON. Objects whose structure includes a circular reference, cannot be passed.
See Also