IJavascriptObjectRepositoryRegister Method |
Version 81.3.100
Register an object for binding in Javascript. You can either
register an object in advance or as part of the
ResolveObject
event that will be called if no object matching object is found in the registry.
Objects binding is now initiated in Javascript through the CefSharp.BindObjectAsync
function (returns a Promise).
For more detailed examples see https://github.com/cefsharp/CefSharp/issues/2246
The equivilient to RegisterJsObject is isAsync = false
The equivilient RegisterAsyncJsObject is isAsync = true
Namespace:
CefSharp
Assembly:
CefSharp (in CefSharp.dll) Version: 81.3.100.0 (81.3.100.0)
Syntaxvoid Register(
string name,
Object objectToBind,
bool isAsync,
BindingOptions options = null
)
void Register(
String^ name,
Object^ objectToBind,
bool isAsync,
BindingOptions^ options = nullptr
)
Parameters
- name
- Type: SystemString
object name - objectToBind
- Type: SystemObject
the object that will be bound in javascript - isAsync
- Type: SystemBoolean
if true the object will be registered for async communication,
only methods will be exposed and when called from javascript will return a Promise to be awaited.
This method is newer and recommended for everyone starting out as it is faster and more reliable.
If false then methods and properties will be registered, this method relies on a WCF service to communicate.
If you are targeting .Net Core then you can only use isAsync = true as Microsoft has chosen not to support WCF.
- options (Optional)
- Type: CefSharpBindingOptions
binding options, by default method/property names are camelCased, you can control this
and other advanced options though this class.
See Also