예제 #1
0
        /// <summary>
        /// Gets a property descriptor for an object's own property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="propertyId">The ID of the property</param>
        /// <returns>The property descriptor</returns>
        public JsValue GetOwnPropertyDescriptor(JsPropertyId propertyId)
        {
            JsValue descriptorReference;

            JsErrorHelpers.ThrowIfError(NativeMethods.JsGetOwnPropertyDescriptor(this, propertyId, out descriptorReference));

            return(descriptorReference);
        }
예제 #2
0
        /// <summary>
        /// Determines whether an object has a property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="propertyId">The ID of the property</param>
        /// <returns>Whether the object (or a prototype) has the property</returns>
        public bool HasProperty(JsPropertyId propertyId)
        {
            bool hasProperty;

            JsErrorHelpers.ThrowIfError(NativeMethods.JsHasProperty(this, propertyId, out hasProperty));

            return(hasProperty);
        }
예제 #3
0
        /// <summary>
        /// Gets an object's property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="id">The ID of the property</param>
        /// <returns>The value of the property</returns>
        public JsValue GetProperty(JsPropertyId id)
        {
            JsValue propertyReference;

            JsErrorHelpers.ThrowIfError(NativeMethods.JsGetProperty(this, id, out propertyReference));

            return(propertyReference);
        }
예제 #4
0
        /// <summary>
        /// Deletes an object's property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="propertyId">The ID of the property</param>
        /// <param name="useStrictRules">The property set should follow strict mode rules</param>
        /// <returns>Whether the property was deleted</returns>
        public JsValue DeleteProperty(JsPropertyId propertyId, bool useStrictRules)
        {
            JsValue returnReference;

            JsErrorHelpers.ThrowIfError(NativeMethods.JsDeleteProperty(this, propertyId, useStrictRules, out returnReference));

            return(returnReference);
        }
예제 #5
0
        /// <summary>
        /// Defines a new object's own property from a property descriptor
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="propertyId">The ID of the property</param>
        /// <param name="propertyDescriptor">The property descriptor</param>
        /// <returns>Whether the property was defined</returns>
        public bool DefineProperty(JsPropertyId propertyId, JsValue propertyDescriptor)
        {
            bool result;

            JsErrorHelpers.ThrowIfError(NativeMethods.JsDefineProperty(this, propertyId, propertyDescriptor, out result));

            return(result);
        }
 internal static extern JsErrorCode JsGetPropertyIdFromSymbol(JsValue symbol, out JsPropertyId propertyId);
 internal static extern JsErrorCode JsGetPropertyIdType(JsPropertyId propertyId,
                                                        out JsPropertyIdType propertyIdType);
 internal static extern JsErrorCode JsGetSymbolFromPropertyId(JsPropertyId propertyId, out JsValue symbol);
 internal static extern JsErrorCode JsGetOwnPropertyDescriptor(JsValue obj, JsPropertyId propertyId,
                                                               out JsValue propertyDescriptor);
 internal static extern JsErrorCode JsCopyPropertyIdUtf8(JsPropertyId propertyId, byte[] buffer,
                                                         UIntPtr bufferSize, out UIntPtr length);
 internal static extern JsErrorCode JsCreatePropertyIdUtf8(string name, UIntPtr length,
                                                           out JsPropertyId propertyId);
 internal static extern JsErrorCode JsDefineProperty(JsValue obj, JsPropertyId propertyId,
                                                     JsValue propertyDescriptor, out bool result);
 internal static extern JsErrorCode JsDeleteProperty(JsValue obj, JsPropertyId propertyId, bool useStrictRules,
                                                     out JsValue result);
 internal static extern JsErrorCode JsHasProperty(JsValue obj, JsPropertyId propertyId, out bool hasProperty);
 internal static extern JsErrorCode JsSetProperty(JsValue obj, JsPropertyId propertyId, JsValue value,
                                                  bool useStrictRules);
예제 #16
0
 /// <summary>
 /// Sets an object's property
 /// </summary>
 /// <remarks>
 /// Requires an active script context.
 /// </remarks>
 /// <param name="id">The ID of the property</param>
 /// <param name="value">The new value of the property</param>
 /// <param name="useStrictRules">The property set should follow strict mode rules</param>
 public void SetProperty(JsPropertyId id, JsValue value, bool useStrictRules)
 {
     JsErrorHelpers.ThrowIfError(NativeMethods.JsSetProperty(this, id, value, useStrictRules));
 }
 internal static extern JsErrorCode JsGetPropertyIdFromName(string name, out JsPropertyId propertyId);
 internal static extern JsErrorCode JsGetPropertyNameFromId(JsPropertyId propertyId, out string name);
 internal static extern JsErrorCode JsGetProperty(JsValue obj, JsPropertyId propertyId, out JsValue value);