This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expose .NET class to JavaScript
Applies Only to CefSharp apps
.NET object bounded to JavaScript details can be found on CefSharp site at section [How do you expose a .NET class to JavaScript?].
Chromely allows .NET objects exposed to JavaScript to be registered in ChromelyConfiguration. Registration is done by adding instance of ChromelyJsHandler to the IoC container. The ChromelyJsHandler:
public class ChromelyJsHandler
{
......
public string Key { get; private set; }
public string JsMethod { get; set; }
public object BoundObject { get; set; }
public object BindingOptions { get; set; }
public bool RegisterAsAsync { get; set; }
}
where RegisterAsAsync determines whether CefSharp RegisterAsyncJsObject or RegisterJsObject method is used for registration.
Following is an example of how registration is done:
ChromelyConfiguration config = ChromelyConfiguration()
.Create()
....
.RegisterJsHandler("boundControllerAsync", new CefSharpBoundObject(), null, true);
.RegisterJsHandler("boundControllerAsync2", new NewCefSharpBoundObject(), null, false);
.....
Chromely
Getting Started
The Basics
Digging Deeper
- Sub-Process
- Infrastructure
- Restful Resources
- Register Resource Assemblies
- Custom Local Resource Handling
- Custom Scheme Handling
- Expose .NET class to JavaScript
- Generic Message Routing
- Real-time with Websocket
- External Url Registration
Angular - React - Vue