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 ) : IeJsValue
data System.IntPtr External data that the object will represent. May be null.
finalizer JsObjectFinalizeCallback A callback for when the object is finalized. May be null.
return IeJsValue
Example #1
0
        private IeJsValue CreateExternalObjectFromObject(object value)
        {
            GCHandle handle = GCHandle.Alloc(value);

            _externalObjects.Add(value);

            IeJsValue objValue = IeJsValue.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);
        }