C# Класс MsieJavaScriptEngine.JsRt.JavaScriptValue

A JavaScript value.
A JavaScript value is one of the following types of values: Undefined, Null, Boolean, String, Number, or Object.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddRef ( ) : uint

Adds a reference to the object.

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

CallFunction ( ) : JavaScriptValue

Invokes a function.

Requires an active script context.

ConstructObject ( ) : JavaScriptValue

Invokes a function as a constructor.

Requires an active script context.

ConvertToBoolean ( ) : JavaScriptValue

Converts the value to Boolean using regular JavaScript semantics.

Requires an active script context.

ConvertToNumber ( ) : JavaScriptValue

Converts the value to Number using regular JavaScript semantics.

Requires an active script context.

ConvertToObject ( ) : JavaScriptValue

Converts the value to Object using regular JavaScript semantics.

Requires an active script context.

ConvertToString ( ) : JavaScriptValue

Converts the value to String using regular JavaScript semantics.

Requires an active script context.

CreateArray ( uint length ) : JavaScriptValue

Creates a JavaScript array object.

Requires an active script context.

CreateError ( JavaScriptValue message ) : JavaScriptValue

Creates a new JavaScript error object

Requires an active script context.

CreateExternalObject ( IntPtr data, JavaScriptObjectFinalizeCallback finalizer ) : JavaScriptValue

Creates a new Object that stores some external data.

Requires an active script context.

CreateFunction ( JavaScriptNativeFunction function ) : JavaScriptValue

Creates a new JavaScript function.

Requires an active script context.

CreateFunction ( JavaScriptNativeFunction function, IntPtr callbackData ) : JavaScriptValue

Creates a new JavaScript function.

Requires an active script context.

CreateObject ( ) : JavaScriptValue

Creates a new Object.

Requires an active script context.

CreateRangeError ( JavaScriptValue message ) : JavaScriptValue

Creates a new JavaScript RangeError error object

Requires an active script context.

CreateReferenceError ( JavaScriptValue message ) : JavaScriptValue

Creates a new JavaScript ReferenceError error object

Requires an active script context.

CreateSyntaxError ( JavaScriptValue message ) : JavaScriptValue

Creates a new JavaScript SyntaxError error object

Requires an active script context.

CreateTypeError ( JavaScriptValue message ) : JavaScriptValue

Creates a new JavaScript TypeError error object

Requires an active script context.

CreateUriError ( JavaScriptValue message ) : JavaScriptValue

Creates a new JavaScript URIError error object

Requires an active script context.

DefineProperty ( JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor ) : bool

Defines a new object's own property from a property descriptor.

Requires an active script context.

DeleteIndexedProperty ( JavaScriptValue index ) : void

Delete the value at the specified index of an object.

Requires an active script context.

DeleteProperty ( JavaScriptPropertyId propertyId, bool useStrictRules ) : JavaScriptValue

Deletes an object's property.

Requires an active script context.

Equals ( JavaScriptValue other ) : bool

Compare two JavaScript values for equality.

This function is equivalent to the "==" operator in JavaScript.

Requires an active script context.

FromBoolean ( bool value ) : JavaScriptValue

Creates a Boolean value from a bool value.

Requires an active script context.

FromDouble ( double value ) : JavaScriptValue

Creates a Number value from a double value.

Requires an active script context.

FromInt32 ( int value ) : JavaScriptValue

Creates a Number value from a int value.

Requires an active script context.

FromObject ( object value ) : JavaScriptValue

Creates a JavaScript value that is a projection of the passed in object.

Requires an active script context.

FromString ( string value ) : JavaScriptValue

Creates a String value from a string pointer.

Requires an active script context.

GetIndexedProperty ( JavaScriptValue index ) : JavaScriptValue

Retrieve the value at the specified index of an object.

Requires an active script context.

GetOwnPropertyDescriptor ( JavaScriptPropertyId propertyId ) : JavaScriptValue

Gets a property descriptor for an object's own property.

Requires an active script context.

GetOwnPropertyNames ( ) : JavaScriptValue

Gets the list of all properties on the object.

Requires an active script context.

GetProperty ( JavaScriptPropertyId id ) : JavaScriptValue

Gets an object's property.

Requires an active script context.

HasIndexedProperty ( JavaScriptValue index ) : bool

Test if an object has a value at the specified index.

Requires an active script context.

HasProperty ( JavaScriptPropertyId propertyId ) : bool

Determines whether an object has a property.

Requires an active script context.

PreventExtension ( ) : void

Sets an object to not be extensible.

Requires an active script context.

Release ( ) : uint

Releases a reference to the object.

Removes a reference that was created by AddRef.

SetIndexedProperty ( JavaScriptValue index, JavaScriptValue value ) : void

Set the value at the specified index of an object.

Requires an active script context.

SetProperty ( JavaScriptPropertyId id, JavaScriptValue value, bool useStrictRules ) : void

Sets an object's property.

Requires an active script context.

StrictEquals ( JavaScriptValue other ) : bool

Compare two JavaScript values for strict equality.

This function is equivalent to the "===" operator in JavaScript.

Requires an active script context.

ToBoolean ( ) : bool

Retrieves the bool value of a Boolean value.

Requires an active script context.

ToDouble ( ) : double

Retrieves the double value of a Number value.

This function retrieves the value of a Number value. It will fail with InvalidArgument if the type of the value is not Number.

Requires an active script context.

ToObject ( ) : object

Retrieves the object representation of an Object value.

Requires an active script context.

ToString ( ) : string

Retrieves the string pointer of a String value.

This function retrieves the string pointer of a String value. It will fail with InvalidArgument if the type of the value is not String.

Requires an active script context.

Приватные методы

Метод Описание
JavaScriptValue ( IntPtr reference ) : System

Initializes a new instance of the JavaScriptValue struct.

Описание методов

AddRef() публичный Метод

Adds a reference to the object.
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
public AddRef ( ) : uint
Результат uint

CallFunction() публичный Метод

Invokes a function.
Requires an active script context.
public CallFunction ( ) : JavaScriptValue
Результат JavaScriptValue

ConstructObject() публичный Метод

Invokes a function as a constructor.
Requires an active script context.
public ConstructObject ( ) : JavaScriptValue
Результат JavaScriptValue

ConvertToBoolean() публичный Метод

Converts the value to Boolean using regular JavaScript semantics.
Requires an active script context.
public ConvertToBoolean ( ) : JavaScriptValue
Результат JavaScriptValue

ConvertToNumber() публичный Метод

Converts the value to Number using regular JavaScript semantics.
Requires an active script context.
public ConvertToNumber ( ) : JavaScriptValue
Результат JavaScriptValue

ConvertToObject() публичный Метод

Converts the value to Object using regular JavaScript semantics.
Requires an active script context.
public ConvertToObject ( ) : JavaScriptValue
Результат JavaScriptValue

ConvertToString() публичный Метод

Converts the value to String using regular JavaScript semantics.
Requires an active script context.
public ConvertToString ( ) : JavaScriptValue
Результат JavaScriptValue

CreateArray() публичный статический Метод

Creates a JavaScript array object.
Requires an active script context.
public static CreateArray ( uint length ) : JavaScriptValue
length uint The initial length of the array.
Результат JavaScriptValue

CreateError() публичный статический Метод

Creates a new JavaScript error object
Requires an active script context.
public static CreateError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Результат JavaScriptValue

CreateExternalObject() публичный статический Метод

Creates a new Object that stores some external data.
Requires an active script context.
public static CreateExternalObject ( IntPtr data, JavaScriptObjectFinalizeCallback finalizer ) : JavaScriptValue
data System.IntPtr External data that the object will represent. May be null.
finalizer JavaScriptObjectFinalizeCallback /// A callback for when the object is finalized. May be null. ///
Результат JavaScriptValue

CreateFunction() публичный статический Метод

Creates a new JavaScript function.
Requires an active script context.
public static CreateFunction ( JavaScriptNativeFunction function ) : JavaScriptValue
function JavaScriptNativeFunction The method to call when the function is invoked.
Результат JavaScriptValue

CreateFunction() публичный статический Метод

Creates a new JavaScript function.
Requires an active script context.
public static CreateFunction ( JavaScriptNativeFunction function, IntPtr callbackData ) : JavaScriptValue
function JavaScriptNativeFunction The method to call when the function is invoked.
callbackData System.IntPtr Data to be provided to all function callbacks.
Результат JavaScriptValue

CreateObject() публичный статический Метод

Creates a new Object.
Requires an active script context.
public static CreateObject ( ) : JavaScriptValue
Результат JavaScriptValue

CreateRangeError() публичный статический Метод

Creates a new JavaScript RangeError error object
Requires an active script context.
public static CreateRangeError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Результат JavaScriptValue

CreateReferenceError() публичный статический Метод

Creates a new JavaScript ReferenceError error object
Requires an active script context.
public static CreateReferenceError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Результат JavaScriptValue

CreateSyntaxError() публичный статический Метод

Creates a new JavaScript SyntaxError error object
Requires an active script context.
public static CreateSyntaxError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Результат JavaScriptValue

CreateTypeError() публичный статический Метод

Creates a new JavaScript TypeError error object
Requires an active script context.
public static CreateTypeError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Результат JavaScriptValue

CreateUriError() публичный статический Метод

Creates a new JavaScript URIError error object
Requires an active script context.
public static CreateUriError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Результат JavaScriptValue

DefineProperty() публичный Метод

Defines a new object's own property from a property descriptor.
Requires an active script context.
public DefineProperty ( JavaScriptPropertyId propertyId, JavaScriptValue propertyDescriptor ) : bool
propertyId JavaScriptPropertyId The ID of the property.
propertyDescriptor JavaScriptValue The property descriptor.
Результат bool

DeleteIndexedProperty() публичный Метод

Delete the value at the specified index of an object.
Requires an active script context.
public DeleteIndexedProperty ( JavaScriptValue index ) : void
index JavaScriptValue The index to delete.
Результат void

DeleteProperty() публичный Метод

Deletes an object's property.
Requires an active script context.
public DeleteProperty ( JavaScriptPropertyId propertyId, bool useStrictRules ) : JavaScriptValue
propertyId JavaScriptPropertyId The ID of the property.
useStrictRules bool The property set should follow strict mode rules.
Результат JavaScriptValue

Equals() публичный Метод

Compare two JavaScript values for equality.

This function is equivalent to the "==" operator in JavaScript.

Requires an active script context.

public Equals ( JavaScriptValue other ) : bool
other JavaScriptValue The object to compare.
Результат bool

FromBoolean() публичный статический Метод

Creates a Boolean value from a bool value.
Requires an active script context.
public static FromBoolean ( bool value ) : JavaScriptValue
value bool The value to be converted.
Результат JavaScriptValue

FromDouble() публичный статический Метод

Creates a Number value from a double value.
Requires an active script context.
public static FromDouble ( double value ) : JavaScriptValue
value double The value to be converted.
Результат JavaScriptValue

FromInt32() публичный статический Метод

Creates a Number value from a int value.
Requires an active script context.
public static FromInt32 ( int value ) : JavaScriptValue
value int The value to be converted.
Результат JavaScriptValue

FromObject() публичный статический Метод

Creates a JavaScript value that is a projection of the passed in object.
Requires an active script context.
public static FromObject ( object value ) : JavaScriptValue
value object An object to be projected.
Результат JavaScriptValue

FromString() публичный статический Метод

Creates a String value from a string pointer.
Requires an active script context.
public static FromString ( string value ) : JavaScriptValue
value string The string to convert to a String value.
Результат JavaScriptValue

GetIndexedProperty() публичный Метод

Retrieve the value at the specified index of an object.
Requires an active script context.
public GetIndexedProperty ( JavaScriptValue index ) : JavaScriptValue
index JavaScriptValue The index to retrieve.
Результат JavaScriptValue

GetOwnPropertyDescriptor() публичный Метод

Gets a property descriptor for an object's own property.
Requires an active script context.
public GetOwnPropertyDescriptor ( JavaScriptPropertyId propertyId ) : JavaScriptValue
propertyId JavaScriptPropertyId The ID of the property.
Результат JavaScriptValue

GetOwnPropertyNames() публичный Метод

Gets the list of all properties on the object.
Requires an active script context.
public GetOwnPropertyNames ( ) : JavaScriptValue
Результат JavaScriptValue

GetProperty() публичный Метод

Gets an object's property.
Requires an active script context.
public GetProperty ( JavaScriptPropertyId id ) : JavaScriptValue
id JavaScriptPropertyId The ID of the property.
Результат JavaScriptValue

HasIndexedProperty() публичный Метод

Test if an object has a value at the specified index.
Requires an active script context.
public HasIndexedProperty ( JavaScriptValue index ) : bool
index JavaScriptValue The index to test.
Результат bool

HasProperty() публичный Метод

Determines whether an object has a property.
Requires an active script context.
public HasProperty ( JavaScriptPropertyId propertyId ) : bool
propertyId JavaScriptPropertyId The ID of the property.
Результат bool

PreventExtension() публичный Метод

Sets an object to not be extensible.
Requires an active script context.
public PreventExtension ( ) : void
Результат void

Release() публичный Метод

Releases a reference to the object.
Removes a reference that was created by AddRef.
public Release ( ) : uint
Результат uint

SetIndexedProperty() публичный Метод

Set the value at the specified index of an object.
Requires an active script context.
public SetIndexedProperty ( JavaScriptValue index, JavaScriptValue value ) : void
index JavaScriptValue The index to set.
value JavaScriptValue The value to set.
Результат void

SetProperty() публичный Метод

Sets an object's property.
Requires an active script context.
public SetProperty ( JavaScriptPropertyId id, JavaScriptValue value, bool useStrictRules ) : void
id JavaScriptPropertyId The ID of the property.
value JavaScriptValue The new value of the property.
useStrictRules bool The property set should follow strict mode rules.
Результат void

StrictEquals() публичный Метод

Compare two JavaScript values for strict equality.

This function is equivalent to the "===" operator in JavaScript.

Requires an active script context.

public StrictEquals ( JavaScriptValue other ) : bool
other JavaScriptValue The object to compare.
Результат bool

ToBoolean() публичный Метод

Retrieves the bool value of a Boolean value.
Requires an active script context.
public ToBoolean ( ) : bool
Результат bool

ToDouble() публичный Метод

Retrieves the double value of a Number value.

This function retrieves the value of a Number value. It will fail with InvalidArgument if the type of the value is not Number.

Requires an active script context.

public ToDouble ( ) : double
Результат double

ToObject() публичный Метод

Retrieves the object representation of an Object value.
Requires an active script context.
public ToObject ( ) : object
Результат object

ToString() публичный Метод

Retrieves the string pointer of a String value.

This function retrieves the string pointer of a String value. It will fail with InvalidArgument if the type of the value is not String.

Requires an active script context.

public ToString ( ) : string
Результат string