C# Класс JavaScriptEngineSwitcher.ChakraCore.JsRt.JsValue

The JavaScript value
The 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 ( ) : JsValue

Invokes a function

Requires an active script context.

ConstructObject ( ) : JsValue

Invokes a function as a constructor

Requires an active script context.

ConvertToBoolean ( ) : JsValue

Converts a value to Boolean using regular JavaScript semantics

Requires an active script context.

ConvertToNumber ( ) : JsValue

Converts a value to Number using regular JavaScript semantics

Requires an active script context.

ConvertToObject ( ) : JsValue

Converts a value to Object using regular JavaScript semantics

Requires an active script context.

ConvertToString ( ) : JsValue

Converts a value to String using regular JavaScript semantics

Requires an active script context.

CreateArray ( uint length ) : JsValue

Creates a JavaScript array object

Requires an active script context.

CreateError ( JsValue message ) : JsValue

Creates a new JavaScript error object

Requires an active script context.

CreateExternalObject ( IntPtr data, JsObjectFinalizeCallback finalizer ) : JsValue

Creates a new Object that stores some external data

Requires an active script context.

CreateFunction ( JsNativeFunction function ) : JsValue

Creates a new JavaScript function

Requires an active script context.

CreateFunction ( JsNativeFunction function, IntPtr callbackData ) : JsValue

Creates a new JavaScript function

Requires an active script context.

CreateObject ( ) : JsValue

Creates a new Object

Requires an active script context.

CreateRangeError ( JsValue message ) : JsValue

Creates a new JavaScript RangeError error object

Requires an active script context.

CreateReferenceError ( JsValue message ) : JsValue

Creates a new JavaScript ReferenceError error object

Requires an active script context.

CreateSyntaxError ( JsValue message ) : JsValue

Creates a new JavaScript SyntaxError error object

Requires an active script context.

CreateTypeError ( JsValue message ) : JsValue

Creates a new JavaScript TypeError error object

Requires an active script context.

CreateUriError ( JsValue message ) : JsValue

Creates a new JavaScript URIError error object

Requires an active script context.

DefineProperty ( JsPropertyId propertyId, JsValue propertyDescriptor ) : bool

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

Requires an active script context.

DeleteIndexedProperty ( JsValue index ) : void

Deletes d value at the specified index of an object

Requires an active script context.

DeleteProperty ( JsPropertyId propertyId, bool useStrictRules ) : JsValue

Deletes an object's property

Requires an active script context.

Equals ( JsValue 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 ) : JsValue

Creates a Boolean value from a bool value

Requires an active script context.

FromDouble ( double value ) : JsValue

Creates a Number value from a double value

Requires an active script context.

FromInt32 ( int value ) : JsValue

Creates a Number value from a int value

Requires an active script context.

FromString ( string value ) : JsValue

Creates a String value from a string pointer

Requires an active script context.

GetIndexedProperty ( JsValue index ) : JsValue

Retrieves a value at the specified index of an object

Requires an active script context.

GetOwnPropertyDescriptor ( JsPropertyId propertyId ) : JsValue

Gets a property descriptor for an object's own property

Requires an active script context.

GetOwnPropertyNames ( ) : JsValue

Gets a list of all properties on the object

Requires an active script context.

GetProperty ( JsPropertyId id ) : JsValue

Gets an object's property

Requires an active script context.

HasIndexedProperty ( JsValue index ) : bool

Test if an object has a value at the specified index

Requires an active script context.

HasProperty ( JsPropertyId 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 ( JsValue index, JsValue value ) : void

Sets a value at the specified index of an object

Requires an active script context.

SetProperty ( JsPropertyId id, JsValue value, bool useStrictRules ) : void

Sets an object's property

Requires an active script context.

StrictEquals ( JsValue 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 a bool value of a Boolean value

Requires an active script context.

ToDouble ( ) : double

Retrieves a 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.

ToInt32 ( ) : int

Retrieves a int 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.

ToString ( ) : string

Retrieves a 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.

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

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

Initializes a new instance of the JsValue 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 ( ) : JsValue
Результат JsValue

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Compare two JavaScript values for equality

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

Requires an active script context.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Determines whether an object has a property
Requires an active script context.
public HasProperty ( JsPropertyId propertyId ) : bool
propertyId JsPropertyId 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() публичный Метод

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

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

Sets an object's property
Requires an active script context.
public SetProperty ( JsPropertyId id, JsValue value, bool useStrictRules ) : void
id JsPropertyId The ID of the property
value JsValue 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 ( JsValue other ) : bool
other JsValue The object to compare
Результат bool

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

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

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

Retrieves a 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

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

Retrieves a int 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 ToInt32 ( ) : int
Результат int

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

Retrieves a 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