Skip to content

JSValueScope class

A scope that controls the lifetime of JS values. When the scope is disposed, any JS values created within the scope are released unless they are held by a strong JSReference.

C#
public sealed class JSValueScope : IDisposable

Public Members

namedescription
JSValueScope(…)Creates a new instance of a JSValueScope with a specified scope type. (2 constructors)
static Current { get; }Gets the current JS value scope.
EnvironmentHandle { get; }Gets the environment handle for the scope, or throws an exception if the scope is disposed or access from the current thread is invalid.
IsDisposed { get; }
ModuleContext { get; }
Runtime { get; }
RuntimeContext { get; }
ScopeType { get; }
Dispose()
Escape(…)
explicit operator

Remarks

Every call from JS to .NET creates a separate scope for the duration of the call. That means any JS values created during the call are released when the call returns, unless they are returned to JS or held by a strong JSReference.

See Also

Released under the MIT license