Value
Object Hierarchy:
Description:
JSCValue represents a reference to a value in a Context.
The JSCValue protects the referenced value from being garbage collected.
Namespace: JSC
Package: javascriptcoregtk-4.1
Content:
Properties:
Creation methods:
- protected Value ()
- public Value.array_buffer (Context context, void* data, size_t size, DestroyNotify? destroy_notify, void* user_data)
Creates a new arraybuffer from existing
data
in memory. - public Value.array_from_garray (Context context, GenericArray<Value>? array)
Create a new Value referencing an array with the items from
array
. - public Value.array_from_strv (Context context, string[] strv)
Create a new Value referencing an array of strings with the items from
strv
. - public Value.boolean (Context context, bool value)
Create a new Value from
value
- public Value.from_json (Context context, string json)
Create a new Value referencing a new value created by parsing
json
. - public Value.function_variadic (Context context, string? name, Callback callback, void* user_data, DestroyNotify? destroy_notify, Type return_type)
Create a function in
context
. - public Value.functionv (Context context, string? name, Callback callback, void* user_data, DestroyNotify? destroy_notify, Type return_type, Type[]? parameter_types)
Create a function in
context
. - public Value.null (Context context)
Create a new Value referencing <function> null</function> in
context
. - public Value.number (Context context, double number)
Create a new Value from
number
. - public Value.object (Context context, void* instance, Class? jsc_class)
Create a new Value from
instance
. - public Value.string (Context context, string? string)
Create a new Value from
string
. - public Value.string_from_bytes (Context context, Bytes? bytes)
Create a new Value from
bytes
. - public Value.typed_array (Context context, TypedArrayType type, size_t length)
Create a new typed array containing a given amount of elements.
- public Value.typed_array_with_buffer (Value array_buffer, TypedArrayType type, size_t offset, ssize_t length)
Create a new typed array value with elements from an array buffer.
- public Value.undefined (Context context)
Create a new Value referencing <function> undefined</function> in
context
.
Methods:
- public void* array_buffer_get_data (size_t? size)
Gets a pointer to memory that contains the array buffer data.
- public size_t array_buffer_get_size ()
Gets the size in bytes of the array buffer.
- public Value constructor_callv (Value[]? parameters)
Invoke <function>new</function> with constructor referenced by this.
- public Value function_callv (Value[]? parameters)
Call function referenced by this, passing the given
parameters
. - public unowned Context get_context ()
Get the Context in which this was created.
- public bool is_array ()
Get whether the value referenced by this is an array.
- public bool is_array_buffer ()
Check whether the this is an arraybuffer.
- public bool is_boolean ()
Get whether the value referenced by this is a boolean.
- public bool is_constructor ()
Get whether the value referenced by this is a constructor.
- public bool is_function ()
Get whether the value referenced by this is a function
- public bool is_null ()
Get whether the value referenced by this is <function>null</function>.
- public bool is_number ()
Get whether the value referenced by this is a number.
- public bool is_object ()
Get whether the value referenced by this is an object.
- public bool is_string ()
Get whether the value referenced by this is a string
- public bool is_typed_array ()
Determines whether a value is a typed array.
- public bool is_undefined ()
Get whether the value referenced by this is <function>undefined</function>.
- public void object_define_property_accessor (string property_name, ValuePropertyFlags flags, Type property_type, Callback? getter, Callback? setter, void* user_data, DestroyNotify? destroy_notify)
Define or modify a property with
property_name
in object referenced by this. - public void object_define_property_data (string property_name, ValuePropertyFlags flags, Value? property_value)
Define or modify a property with
property_name
in object referenced by this. - public bool object_delete_property (string name)
Try to delete property with
name
from this. - public string[]? object_enumerate_properties ()
Get the list of property names of this.
- public Value object_get_property (string name)
Get property with
name
from this . - public Value object_get_property_at_index (uint index)
Get property at
index
from this . - public bool object_has_property (string name)
Get whether this has property with
name
. - public Value object_invoke_methodv (string name, Value[]? parameters)
Invoke method with
name
on object referenced by this, passing the givenparameters
. - public bool object_is_instance_of (string name)
Get whether the value referenced by this is an instance of class
name
. - public void object_set_property (string name, Value property)
Set
property
withname
on this. - public void object_set_property_at_index (uint index, Value property)
Set
property
atindex
on this. - public bool to_boolean ()
Convert this to a boolean.
- public double to_double ()
Convert this to a double.
- public int32 to_int32 ()
Convert this to a int32.
- public string to_json (uint indent)
Create a JSON string of this serialization.
- public string to_string ()
Convert this to a string.
- public Bytes to_string_as_bytes ()
Convert this to a string and return the results as Bytes.
- public Value typed_array_get_buffer ()
Obtain the arraybuffer for the memory region of the typed array elements.
- public void* typed_array_get_data (out size_t length)
Obtains a pointer to the memory region that holds the elements of the typed array; modifications done to them will be visible to JavaScript code.
- public size_t typed_array_get_length ()
Gets the number of elements in a typed array.
- public size_t typed_array_get_offset ()
Gets the offset over the underlying array buffer data.
- public size_t typed_array_get_size ()
Gets the size of a typed array.
- public TypedArrayType typed_array_get_type ()
Gets the type of elements contained in a typed array.
Inherited Members:
All known members inherited from class GLib.Object