WebIdlAgent<TAdapter, TValue> Class
The WebIDL bindings of the DOM for a JavaScript engine (an agent: the similar-origin window agent, or the agent of a worker): the realms of the global objects, and the JavaScript objects of the .NET objects. A platform object has a single JavaScript object, whichever realm accesses it, so the wrappers and the callbacks are shared by the realms.
public sealed class WebIdlAgent<TAdapter, TValue> where TAdapter : struct, IJsAdapter<TValue> where TValue : classType parameters
TAdapter- The adapter of the JavaScript engine.
TValue- The type of the JavaScript values of the engine.
Constructors
| Name | Description |
|---|---|
| WebIdlAgent(TAdapter, IWebIdlHost) | Creates the bindings of an engine. |
WebIdlAgent(TAdapter, IWebIdlHost)
WebIdlAgent.csCreates the bindings of an engine.
public WebIdlAgent(TAdapter adapter, IWebIdlHost host)Parameters
adapterTAdapter- The adapter of the engine.
hostIWebIdlHost- The services of the script engine.
Properties
| Name | Description |
|---|---|
| Adapter | Gets the adapter of the engine. |
| CurrentRealm | Gets the realm of the running execution context, or null when it is not the realm of a global object. |
| Host | Gets the services of the script engine. |
| RealmCreated | Gets or sets a callback invoked when a realm is created, before any script runs in it: the host can add its own functions to the global object. |
| RealmFactory | Gets or sets a factory of the realms of the engine. The first realm uses the realm that is current when the agent is created; the default factory of the other realms throws NotSupportedException. |
| Realms | Gets the realms. |
Adapter
WebIdlAgent.csGets the adapter of the engine.
public TAdapter Adapter { get; }Property value
TAdapter
CurrentRealm
WebIdlAgent.csGets the realm of the running execution context, or null when it is not the realm of a global object.
public WebIdlRealm<TAdapter, TValue>? CurrentRealm { get; }Property value
Host
WebIdlAgent.csRealmCreated
WebIdlAgent.csGets or sets a callback invoked when a realm is created, before any script runs in it: the host can add its own functions to the global object.
public Action<WebIdlRealm<TAdapter, TValue>>? RealmCreated { get; set; }Property value
RealmFactory
WebIdlAgent.csGets or sets a factory of the realms of the engine. The first realm uses the realm that is current when the agent is created; the default factory of the other realms throws NotSupportedException.
Property value
Realms
WebIdlAgent.csMethods
| Name | Description |
|---|---|
| DisposeWebAssembly() | Releases the WebAssembly store of the agent (the native resources of the runtime). |
| GetAssociatedRealm(TValue) | Returns the associated realm of a callback (https://webidl.spec.whatwg.org/#dfn-associated-realm): the realm whose Function.prototype (for a function) or Object.prototype is in the prototype chain of the object. The prototype chain of a revoked proxy cannot be read: its associated realm is the realm that created it. |
| GetExceptionValue(Exception, WebIdlRealm<TAdapter, TValue>) | Returns the JavaScript value of an exception thrown by the engine or by the DOM, in the current realm. |
| GetRealm(GlobalScope) | Returns the realm of a global object, creating it on first use. |
| GetRealm(object) | Returns the realm of an engine realm, or null. |
| GetRealmByGlobal(TValue) | Returns the realm whose global object is global, or null. |
| TryGetRealm(GlobalScope) | Returns the realm of a global object, or null when it was not created. |
DisposeWebAssembly()
WebIdlAgent.csReleases the WebAssembly store of the agent (the native resources of the runtime).
public void DisposeWebAssembly()GetAssociatedRealm(TValue)
WebIdlAgent.csReturns the associated realm of a callback (https://webidl.spec.whatwg.org/#dfn-associated-realm): the realm whose Function.prototype (for a function) or Object.prototype is in the prototype chain of the object. The prototype chain of a revoked proxy cannot be read: its associated realm is the realm that created it.
public WebIdlRealm<TAdapter, TValue>? GetAssociatedRealm(TValue obj)GetExceptionValue(Exception, WebIdlRealm<TAdapter, TValue>)
WebIdlAgent.csReturns the JavaScript value of an exception thrown by the engine or by the DOM, in the current realm.
public TValue GetExceptionValue(Exception exception, WebIdlRealm<TAdapter, TValue> fallbackRealm)GetRealm overloads
GetRealm(GlobalScope)
WebIdlAgent.csReturns the realm of a global object, creating it on first use.
public WebIdlRealm<TAdapter, TValue> GetRealm(GlobalScope global)GetRealm(object)
WebIdlAgent.csReturns the realm of an engine realm, or null.
public WebIdlRealm<TAdapter, TValue>? GetRealm(object engineRealm)GetRealmByGlobal(TValue)
WebIdlAgent.csReturns the realm whose global object is global, or null.
public WebIdlRealm<TAdapter, TValue>? GetRealmByGlobal(TValue global)TryGetRealm(GlobalScope)
WebIdlAgent.csReturns the realm of a global object, or null when it was not created.
public WebIdlRealm<TAdapter, TValue>? TryGetRealm(GlobalScope global)