JSReference.Run method (1 of 2)
Runs an action with the referenced value, using the JSSynchronizationContext
associated with the reference to switch to the JS thread (if necessary) while operating on the value.
C#
public void Run(Action<JSValue> action)
Exceptions
exception | condition |
---|---|
ObjectDisposedException | The reference is disposed. |
NullReferenceException | The reference is weak and the value is not available. |
Remarks
This method may be called from any thread. The action delegate is invoked on the JS thread.
See Also
- struct JSValue
- class JSReference
- namespace Microsoft.JavaScript.NodeApi
JSReference.Run<T> method (2 of 2)
Runs an action with the referenced value, using the JSSynchronizationContext
associated with the reference to switch to the JS thread (if necessary) while operating on the value.
C#
public T Run<T>(Func<JSValue, T> action)
Exceptions
exception | condition |
---|---|
ObjectDisposedException | The reference is disposed. |
NullReferenceException | The reference is weak and the value is not available. |
Remarks
This method may be called from any thread. The action delegate is invoked on the JS thread.
See Also
- struct JSValue
- class JSReference
- namespace Microsoft.JavaScript.NodeApi