CreateExternalObject() public static method

Creates a new Object that stores some external data
Requires an active script context.
public static CreateExternalObject ( IntPtr data, JsObjectFinalizeCallback finalizer ) : EdgeJsValue
data System.IntPtr External data that the object will represent. May be null
finalizer JsObjectFinalizeCallback The callback for when the object is finalized. May be null.
return EdgeJsValue
        private EdgeJsValue CreateExternalObjectFromObject(object value)
        {
            GCHandle handle = GCHandle.Alloc(value);

            _externalObjects.Add(value);

            EdgeJsValue objValue = EdgeJsValue.CreateExternalObject(
                GCHandle.ToIntPtr(handle), _externalObjectFinalizeCallback);
            Type type = value.GetType();

            ProjectFields(objValue, type, true);
            ProjectProperties(objValue, type, true);
            ProjectMethods(objValue, type, true);
            FreezeObject(objValue);

            return(objValue);
        }