C# Class MsieJavaScriptEngine.JsRt.JavaScriptValue

A JavaScript value.
A JavaScript value is one of the following types of values: Undefined, Null, Boolean, String, Number, or Object.
Afficher le fichier Open project: klumsy/PowerShellJS Class Usage Examples

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
JavaScriptValue ( IntPtr reference ) : System

Initializes a new instance of the JavaScriptValue struct.

Method Details

AddRef() public méthode

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
Résultat uint

CallFunction() public méthode

Invokes a function.
Requires an active script context.
public CallFunction ( ) : JavaScriptValue
Résultat JavaScriptValue

ConstructObject() public méthode

Invokes a function as a constructor.
Requires an active script context.
public ConstructObject ( ) : JavaScriptValue
Résultat JavaScriptValue

ConvertToBoolean() public méthode

Converts the value to Boolean using regular JavaScript semantics.
Requires an active script context.
public ConvertToBoolean ( ) : JavaScriptValue
Résultat JavaScriptValue

ConvertToNumber() public méthode

Converts the value to Number using regular JavaScript semantics.
Requires an active script context.
public ConvertToNumber ( ) : JavaScriptValue
Résultat JavaScriptValue

ConvertToObject() public méthode

Converts the value to Object using regular JavaScript semantics.
Requires an active script context.
public ConvertToObject ( ) : JavaScriptValue
Résultat JavaScriptValue

ConvertToString() public méthode

Converts the value to String using regular JavaScript semantics.
Requires an active script context.
public ConvertToString ( ) : JavaScriptValue
Résultat JavaScriptValue

CreateArray() public static méthode

Creates a JavaScript array object.
Requires an active script context.
public static CreateArray ( uint length ) : JavaScriptValue
length uint The initial length of the array.
Résultat JavaScriptValue

CreateError() public static méthode

Creates a new JavaScript error object
Requires an active script context.
public static CreateError ( JavaScriptValue message ) : JavaScriptValue
message JavaScriptValue Message for the error object.
Résultat JavaScriptValue

CreateExternalObject() public static méthode

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. ///
Résultat JavaScriptValue

CreateFunction() public static méthode

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.
Résultat JavaScriptValue

CreateFunction() public static méthode

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.
Résultat JavaScriptValue

CreateObject() public static méthode

Creates a new Object.
Requires an active script context.
public static CreateObject ( ) : JavaScriptValue
Résultat JavaScriptValue

CreateRangeError() public static méthode

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.
Résultat JavaScriptValue

CreateReferenceError() public static méthode

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.
Résultat JavaScriptValue

CreateSyntaxError() public static méthode

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.
Résultat JavaScriptValue

CreateTypeError() public static méthode

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.
Résultat JavaScriptValue

CreateUriError() public static méthode

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.
Résultat JavaScriptValue

DefineProperty() public méthode

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.
Résultat bool

DeleteIndexedProperty() public méthode

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.
Résultat void

DeleteProperty() public méthode

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.
Résultat JavaScriptValue

Equals() public méthode

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.
Résultat bool

FromBoolean() public static méthode

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.
Résultat JavaScriptValue

FromDouble() public static méthode

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.
Résultat JavaScriptValue

FromInt32() public static méthode

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.
Résultat JavaScriptValue

FromObject() public static méthode

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.
Résultat JavaScriptValue

FromString() public static méthode

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.
Résultat JavaScriptValue

GetIndexedProperty() public méthode

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.
Résultat JavaScriptValue

GetOwnPropertyDescriptor() public méthode

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.
Résultat JavaScriptValue

GetOwnPropertyNames() public méthode

Gets the list of all properties on the object.
Requires an active script context.
public GetOwnPropertyNames ( ) : JavaScriptValue
Résultat JavaScriptValue

GetProperty() public méthode

Gets an object's property.
Requires an active script context.
public GetProperty ( JavaScriptPropertyId id ) : JavaScriptValue
id JavaScriptPropertyId The ID of the property.
Résultat JavaScriptValue

HasIndexedProperty() public méthode

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.
Résultat bool

HasProperty() public méthode

Determines whether an object has a property.
Requires an active script context.
public HasProperty ( JavaScriptPropertyId propertyId ) : bool
propertyId JavaScriptPropertyId The ID of the property.
Résultat bool

PreventExtension() public méthode

Sets an object to not be extensible.
Requires an active script context.
public PreventExtension ( ) : void
Résultat void

Release() public méthode

Releases a reference to the object.
Removes a reference that was created by AddRef.
public Release ( ) : uint
Résultat uint

SetIndexedProperty() public méthode

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.
Résultat void

SetProperty() public méthode

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.
Résultat void

StrictEquals() public méthode

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.
Résultat bool

ToBoolean() public méthode

Retrieves the bool value of a Boolean value.
Requires an active script context.
public ToBoolean ( ) : bool
Résultat bool

ToDouble() public méthode

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
Résultat double

ToObject() public méthode

Retrieves the object representation of an Object value.
Requires an active script context.
public ToObject ( ) : object
Résultat object

ToString() public méthode

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
Résultat string