Skip to content

JSRuntimeContext.GetOrCreateObjectWrapper<T> method

Gets or creates a JS wrapper for an instance of a class.

C#
public JSValue GetOrCreateObjectWrapper<T>(T obj)
    where T : class

Return Value

The JS wrapper.

Remarks

If the class was constructed via JS, then the wrapper created at that time will be found in the map and returned, if the weak reference to it is still valid. Otherwise a new JS object is constructed to wrap the existing instance, and a weak reference to the new wrapper is saved in the map.

See Also

Released under the MIT license