SetObjectAccessor() private method

private SetObjectAccessor ( HandleProxy proxy, Int32 managedObjectID, string name, ManagedAccessorGetter getter, ManagedAccessorSetter setter, V8AccessControl access, V8PropertyAttributes attributes ) : void
proxy HandleProxy
managedObjectID System.Int32
name string
getter ManagedAccessorGetter
setter ManagedAccessorSetter
access V8AccessControl
attributes V8PropertyAttributes
return void
示例#1
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary>
        ///     Calls the V8 'SetAccessor()' function on the underlying native object to create a property that is controlled by
        ///     "getter" and "setter" callbacks.
        ///     <para>WARNING: If you try to set managed accessors on a native-ONLY object (as in, this handle does not yet have a
        ///     managed-side object associated with it) then
        ///     <see cref="V8Engine.CreateObject(InternalHandle, bool)"/> will be called to create a wrapper object so the
        ///     accessor delegates will not get garbage collected, causing errors. You can optionally take control of this yourself
        ///     and call one of the 'CreateObject()' methods on <see cref="V8Engine"/>.</para>
        /// </summary>
        /// <param name="name"> The property name. </param>
        /// <param name="getter">
        ///     The property getter delegate that returns a value when the property is accessed within JavaScript.
        /// </param>
        /// <param name="setter">
        ///     The property setter delegate that sets AND returns a value when the property is accessed within JavaScript.
        /// </param>
        /// <param name="attributes"> (Optional) The attributes to assign to the property. </param>
        /// <param name="access"> (Optional) The access security on the property. </param>
        /// <seealso cref="M:V8.Net.IV8Object.SetAccessor(string,GetterAccessor,SetterAccessor,V8PropertyAttributes,V8AccessControl)"/>
        public virtual void SetAccessor(string name, GetterAccessor getter, SetterAccessor setter,
                                        V8PropertyAttributes attributes = V8PropertyAttributes.None, V8AccessControl access = V8AccessControl.Default)
        {
            attributes = _CreateAccessorProxies(Engine, name, getter, setter, attributes, access, ref _Getter, ref _Setter);

            Getter = getter;
            Setter = setter;

            V8NetProxy.SetObjectAccessor(this, ID, name, _Getter, _Setter, access, attributes);
        }