public static ThrowIfError ( JsErrorCode error ) : void | ||
error | JsErrorCode | The error |
return | void |
/// <summary> /// Creates a <c>Number</c> value from a <c>int</c> value /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="value">The value to be converted</param> /// <returns>The new <c>Number</c> value</returns> public static IeJsValue FromInt32(int value) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsIntToNumber(value, out reference)); return(reference); }
/// <summary> /// Compare two JavaScript values for strict equality /// </summary> /// <remarks> /// <para> /// This function is equivalent to the "===" operator in JavaScript. /// </para> /// <para> /// Requires an active script context. /// </para> /// </remarks> /// <param name="other">The object to compare</param> /// <returns>Whether the values are strictly equal</returns> public bool StrictEquals(IeJsValue other) { bool equals; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsStrictEquals(this, other, out equals)); return(equals); }
/// <summary> /// Parses a serialized script and returns a <c>Function</c> representing the script /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="script">The script to parse</param> /// <param name="buffer">The serialized script</param> /// <param name="sourceContext">The cookie identifying the script that can be used /// by script contexts that have debugging enabled</param> /// <param name="sourceName">The location the script came from</param> /// <returns>The <c>Function</c> representing the script code</returns> public static IeJsValue ParseScript(string script, byte[] buffer, JsSourceContext sourceContext, string sourceName) { IeJsValue result; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsParseSerializedScript(script, buffer, sourceContext, sourceName, out result)); return(result); }
/// <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 IeJsValue DeleteProperty(IeJsPropertyId propertyId, bool useStrictRules) { IeJsValue returnReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsDeleteProperty(this, propertyId, useStrictRules, out returnReference)); return(returnReference); }
/// <summary> /// Test if an object has a value at the specified index /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="index">The index to test</param> /// <returns>Whether the object has an value at the specified index</returns> public bool HasIndexedProperty(IeJsValue index) { bool hasProperty; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsHasIndexedProperty(this, index, out hasProperty)); return(hasProperty); }
/// <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 IeJsValue GetOwnPropertyDescriptor(IeJsPropertyId propertyId) { IeJsValue descriptorReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsGetOwnPropertyDescriptor(this, propertyId, out descriptorReference)); return(descriptorReference); }
/// <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(IeJsPropertyId propertyId) { bool hasProperty; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsHasProperty(this, propertyId, out hasProperty)); return(hasProperty); }
/// <summary> /// Creates a JavaScript array object /// </summary> /// <remarks> /// Requires an active script context /// </remarks> /// <param name="length">The initial length of the array</param> /// <returns>The new array object</returns> public static IeJsValue CreateArray(uint length) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsCreateArray(length, out reference)); return(reference); }
/// <summary> /// Creates a new JavaScript URIError error object /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="message">Message for the error object</param> /// <returns>The new error object</returns> public static IeJsValue CreateUriError(IeJsValue message) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsCreateURIError(message, out reference)); return(reference); }
/// <summary> /// Creates a new <c>Object</c> that stores some external data /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="data">External data that the object will represent. May be null.</param> /// <param name="finalizer">A callback for when the object is finalized. May be null.</param> /// <returns>The new <c>Object</c></returns> public static IeJsValue CreateExternalObject(IntPtr data, JsObjectFinalizeCallback finalizer) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsCreateExternalObject(data, finalizer, out reference)); return(reference); }
/// <summary> /// Creates a new JavaScript function /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="function">The method to call when the function is invoked</param> /// <param name="callbackData">Data to be provided to all function callbacks</param> /// <returns>The new function object</returns> public static IeJsValue CreateFunction(IeJsNativeFunction function, IntPtr callbackData) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsCreateFunction(function, callbackData, out reference)); return(reference); }
/// <summary> /// Creates a new <c>Object</c> /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The new <c>Object</c></returns> public static IeJsValue CreateObject() { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsCreateObject(out reference)); return(reference); }
/// <summary> /// Creates a JavaScript value that is a projection of the passed in object /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="value">The object to be projected</param> /// <returns>The JavaScript value that is a projection of the object</returns> public static IeJsValue FromObject(object value) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsVariantToValue(ref value, out reference)); return(reference); }
/// <summary> /// Creates a <c>String</c> value from a string pointer /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="value">The string to convert to a <c>String</c> value</param> /// <returns>The new <c>String</c> value</returns> public static IeJsValue FromString(string value) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsPointerToString(value, new UIntPtr((uint)value.Length), out reference)); return(reference); }
/// <summary> /// Converts a value to <c>String</c> using regular JavaScript semantics /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The converted value</returns> public IeJsValue ConvertToString() { IeJsValue stringReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsConvertValueToString(this, out stringReference)); return(stringReference); }
/// <summary> /// Adds a reference to the object /// </summary> /// <remarks> /// This only needs to be called on objects that are not going to be stored somewhere on /// the stack. Calling AddRef ensures that the JavaScript object the value refers to will not be freed /// until Release is called /// </remarks> /// <returns>The object's new reference count</returns> public uint AddRef() { uint count; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsAddRef(this, out count)); return(count); }
/// <summary> /// Converts a value to <c>Object</c> using regular JavaScript semantics /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The converted value</returns> public IeJsValue ConvertToObject() { IeJsValue objectReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsConvertValueToObject(this, out objectReference)); return(objectReference); }
/// <summary> /// Releases a reference to the object /// </summary> /// <remarks> /// Removes a reference that was created by AddRef. /// </remarks> /// <returns>The object's new reference count</returns> public uint Release() { uint count; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsRelease(this, out count)); return(count); }
/// <summary> /// Gets a list of all properties on the object /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The array of property names</returns> public IeJsValue GetOwnPropertyNames() { IeJsValue propertyNamesReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsGetOwnPropertyNames(this, out propertyNamesReference)); return(propertyNamesReference); }
/// <summary> /// Retrieves a <c>bool</c> value of a <c>Boolean</c> value /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The converted value</returns> public bool ToBoolean() { bool value; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsBooleanToBool(this, out value)); return(value); }
/// <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 IeJsValue GetProperty(IeJsPropertyId id) { IeJsValue propertyReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsGetProperty(this, id, out propertyReference)); return(propertyReference); }
/// <summary> /// Retrieves a <c>double</c> value of a <c>Number</c> value /// </summary> /// <remarks> /// <para> /// This function retrieves the value of a Number value. It will fail with /// <c>InvalidArgument</c> if the type of the value is not <c>Number</c>. /// </para> /// <para> /// Requires an active script context. /// </para> /// </remarks> /// <returns>The <c>double</c> value</returns> public double ToDouble() { double value; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsNumberToDouble(this, out value)); return(value); }
/// <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(IeJsPropertyId propertyId, IeJsValue propertyDescriptor) { bool result; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsDefineProperty(this, propertyId, propertyDescriptor, out result)); return(result); }
/// <summary> /// Retrieves a object representation of an <c>Object</c> value /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The object representation of the value</returns> public object ToObject() { object value; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsValueToVariant(this, out value)); return(value); }
/// <summary> /// Retrieve a value at the specified index of an object /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="index">The index to retrieve</param> /// <returns>The retrieved value</returns> public IeJsValue GetIndexedProperty(IeJsValue index) { IeJsValue propertyReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsGetIndexedProperty(this, index, out propertyReference)); return(propertyReference); }
/// <summary> /// Converts a value to <c>Boolean</c> using regular JavaScript semantics /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The converted value</returns> public IeJsValue ConvertToBoolean() { IeJsValue booleanReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsConvertValueToBoolean(this, out booleanReference)); return(booleanReference); }
/// <summary> /// Tells a runtime to do any idle processing it need to do /// </summary> /// <remarks> /// <para> /// If idle processing has been enabled for the current runtime, calling <c>Idle</c> will /// inform the current runtime that the host is idle and that the runtime can perform /// memory cleanup tasks. /// </para> /// <para> /// <c>Idle</c> will also return the number of system ticks until there will be more idle work /// for the runtime to do. Calling <c>Idle</c> before this number of ticks has passed will do /// no work. /// </para> /// <para> /// Requires an active script context. /// </para> /// </remarks> /// <returns>The next system tick when there will be more idle work to do. Returns the /// maximum number of ticks if there no upcoming idle work to do.</returns> public static uint Idle() { uint ticks; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsIdle(out ticks)); return(ticks); }
/// <summary> /// Converts a value to <c>Number</c> using regular JavaScript semantics /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <returns>The converted value</returns> public IeJsValue ConvertToNumber() { IeJsValue numberReference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsConvertValueToNumber(this, out numberReference)); return(numberReference); }
/// <summary> /// Executes a script /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="script">The script to run</param> /// <param name="sourceContext">The cookie identifying the script that can be used by script contexts that have debugging enabled</param> /// <param name="sourceName">The location the script came from</param> /// <returns>The result of the script, if any</returns> public static IeJsValue RunScript(string script, JsSourceContext sourceContext, string sourceName) { IeJsValue result; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsRunScript(script, sourceContext, sourceName, out result)); return(result); }
/// <summary> /// Creates a <c>Number</c> value from a <c>double</c> value /// </summary> /// <remarks> /// Requires an active script context. /// </remarks> /// <param name="value">The value to be converted</param> /// <returns>The new <c>Number</c> value</returns> public static IeJsValue FromDouble(double value) { IeJsValue reference; IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsDoubleToNumber(value, out reference)); return(reference); }