Example #1
0
        /// <summary>
        /// Deletes an object's property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="source">The JavaScript value</param>
        /// <param name="propertyName">The name of the property</param>
        /// <param name="useStrictRules">The property set should follow strict mode rules</param>
        /// <returns>Whether the property was deleted</returns>
        public static EdgeJsValue DeleteProperty(this EdgeJsValue source, string propertyName, bool useStrictRules)
        {
            EdgeJsPropertyId propertyId  = EdgeJsPropertyId.FromString(propertyName);
            EdgeJsValue      resultValue = source.DeleteProperty(propertyId, useStrictRules);

            return(resultValue);
        }
Example #2
0
        /// <summary>
        /// Gets a property descriptor for an object's own property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="source">The JavaScript value</param>
        /// <param name="propertyName">The name of the property</param>
        /// <returns>The property descriptor</returns>
        public static EdgeJsValue GetOwnPropertyDescriptor(this EdgeJsValue source, string propertyName)
        {
            EdgeJsPropertyId propertyId  = EdgeJsPropertyId.FromString(propertyName);
            EdgeJsValue      resultValue = source.GetOwnPropertyDescriptor(propertyId);

            return(resultValue);
        }
Example #3
0
        /// <summary>
        /// Gets an object's property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="source">The JavaScript value</param>
        /// <param name="name">The name of the property</param>
        /// <returns>The value of the property</returns>
        public static EdgeJsValue GetProperty(this EdgeJsValue source, string name)
        {
            EdgeJsPropertyId id          = EdgeJsPropertyId.FromString(name);
            EdgeJsValue      resultValue = source.GetProperty(id);

            return(resultValue);
        }
Example #4
0
        /// <summary>
        /// Determines whether an object has a property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="source">The JavaScript value</param>
        /// <param name="propertyName">The name of the property</param>
        /// <returns>Whether the object (or a prototype) has the property</returns>
        public static bool HasProperty(this EdgeJsValue source, string propertyName)
        {
            EdgeJsPropertyId propertyId = EdgeJsPropertyId.FromString(propertyName);
            bool             result     = source.HasProperty(propertyId);

            return(result);
        }
Example #5
0
        /// <summary>
        /// Defines a new object's own property from a property descriptor
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="source">The JavaScript value</param>
        /// <param name="propertyName">The name of the property</param>
        /// <param name="propertyDescriptor">The property descriptor</param>
        /// <returns>Whether the property was defined</returns>
        public static bool DefineProperty(this EdgeJsValue source, string propertyName, EdgeJsValue propertyDescriptor)
        {
            EdgeJsPropertyId propertyId = EdgeJsPropertyId.FromString(propertyName);
            bool             result     = source.DefineProperty(propertyId, propertyDescriptor);

            return(result);
        }
		internal static extern JsErrorCode JsHasProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId, out bool hasProperty);
		internal static extern JsErrorCode JsSetProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId, EdgeJsValue value, bool useStrictRules);
		internal static extern JsErrorCode JsGetOwnPropertyDescriptor(EdgeJsValue obj, EdgeJsPropertyId propertyId, out EdgeJsValue propertyDescriptor);
		internal static extern JsErrorCode JsGetProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId, out EdgeJsValue value);
 /// <summary>
 /// Sets a 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(EdgeJsPropertyId id, EdgeJsValue value, bool useStrictRules)
 {
     EdgeJsErrorHelpers.ThrowIfError(EdgeNativeMethods.JsSetProperty(this, id, value, useStrictRules));
 }
		internal static extern JsErrorCode JsGetPropertyIdFromName(string name, out EdgeJsPropertyId propertyId);
        /// <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 EdgeJsValue GetOwnPropertyDescriptor(EdgeJsPropertyId propertyId)
        {
            EdgeJsValue descriptorReference;
            EdgeJsErrorHelpers.ThrowIfError(EdgeNativeMethods.JsGetOwnPropertyDescriptor(this, propertyId, out descriptorReference));

            return descriptorReference;
        }
        /// <summary>
        /// Deletes a 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 EdgeJsValue DeleteProperty(EdgeJsPropertyId propertyId, bool useStrictRules)
        {
            EdgeJsValue returnReference;
            EdgeJsErrorHelpers.ThrowIfError(EdgeNativeMethods.JsDeleteProperty(this, propertyId, useStrictRules, out returnReference));

            return returnReference;
        }
        /// <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(EdgeJsPropertyId propertyId, EdgeJsValue propertyDescriptor)
        {
            bool result;
            EdgeJsErrorHelpers.ThrowIfError(EdgeNativeMethods.JsDefineProperty(this, propertyId, propertyDescriptor, out result));

            return result;
        }
Example #15
0
        /// <summary>
        /// Sets an object's property
        /// </summary>
        /// <remarks>
        /// Requires an active script context.
        /// </remarks>
        /// <param name="source">The JavaScript value</param>
        /// <param name="name">The name 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 static void SetProperty(this EdgeJsValue source, string name, EdgeJsValue value, bool useStrictRules)
        {
            EdgeJsPropertyId id = EdgeJsPropertyId.FromString(name);

            source.SetProperty(id, value, useStrictRules);
        }
		internal static extern JsErrorCode JsDeleteProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId, bool useStrictRules, out EdgeJsValue result);
		internal static extern JsErrorCode JsDefineProperty(EdgeJsValue obj, EdgeJsPropertyId propertyId, EdgeJsValue propertyDescriptor, out bool result);
        /// <summary>
        /// Gets a 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 EdgeJsValue GetProperty(EdgeJsPropertyId id)
        {
            EdgeJsValue propertyReference;
            EdgeJsErrorHelpers.ThrowIfError(EdgeNativeMethods.JsGetProperty(this, id, out propertyReference));

            return propertyReference;
        }
		internal static extern JsErrorCode JsGetPropertyNameFromId(EdgeJsPropertyId propertyId, out IntPtr buffer);
        /// <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(EdgeJsPropertyId propertyId)
        {
            bool hasProperty;
            EdgeJsErrorHelpers.ThrowIfError(EdgeNativeMethods.JsHasProperty(this, propertyId, out hasProperty));

            return hasProperty;
        }