Value

class Value(pointer: <Error class: unknown class><<Error class: unknown class>>)

JSCValue represents a reference to a value in a #JSCContext. The JSCValue protects the referenced value from being garbage collected.

Skipped during bindings generation

  • parameter size: Unsupported pointer to primitive type

  • parameter parameters: Array parameter of type Value is not supported

  • parameter parameters: Array parameter of type Value is not supported

  • method object_define_property_accessor: User data 'user_data' cannot be shared by multiple closures

  • parameter parameters: Array parameter of type Value is not supported

  • parameter length: length: Out parameter is not supported

  • constructor new_array: Varargs parameter is not supported

  • parameter array: GLib.PtrArray parameter of type Value is not supported

  • parameter parameter_types: Array parameter of type GType is not supported

Constructors

Link copied to clipboard
constructor(context: Context, data: <Error class: unknown class>? = null, size: <Error class: unknown class>, destroyNotify: <Error class: unknown class>?)

Creates a new %ArrayBuffer from existing @data in memory.

constructor(context: Context, strv: List<String>)

Create a new #JSCValue referencing an array of strings with the items from @strv. If @array is null or empty a new empty array will be created.

constructor(context: Context, value: Boolean)

Create a new #JSCValue from @value

constructor(context: Context, json: String)

Create a new #JSCValue referencing a new value created by parsing @json.

constructor(context: Context, name: String? = null, callback: <Error class: unknown class>, returnType: <Error class: unknown class>)

Create a function in @context. If @name is null an anonymous function will be created. When the function is called by JavaScript or jsc_value_function_call(), @callback is called receiving an #GPtrArray of #JSCValues with the arguments and then @user_data as last parameter. When the function is cleared in @context, @destroy_notify is called with @user_data as parameter.

constructor(context: Context)

Create a new #JSCValue referencing null in @context.

constructor(context: Context, number: <Error class: unknown class>)

Create a new #JSCValue from @number.

constructor(context: Context, instance: <Error class: unknown class>? = null, jscClass: Class? = null)

Create a new #JSCValue from @instance. If @instance is null a new empty object is created. When @instance is provided, @jsc_class must be provided too. @jsc_class takes ownership of

constructor(context: Context, string: String? = null)

Create a new #JSCValue from @string. If you need to create a #JSCValue from a string containing null characters, use jsc_value_new_string_from_bytes() instead.

constructor(context: Context, bytes: <Error class: unknown class>? = null)

Create a new #JSCValue from @bytes.

constructor(context: Context, type: TypedArrayType, length: <Error class: unknown class>)

Create a new typed array containing a given amount of elements.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The #JSCContext in which the value was created.

Link copied to clipboard
val javascriptcoreValuePointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun arrayBufferGetSize(): <Error class: unknown class>

Gets the size in bytes of the array buffer.

Link copied to clipboard

Get whether the value referenced by @value is an array.

Link copied to clipboard

Check whether the @value is an %ArrayBuffer.

Link copied to clipboard

Get whether the value referenced by @value is a boolean.

Link copied to clipboard

Get whether the value referenced by @value is a constructor.

Link copied to clipboard

Get whether the value referenced by @value is a function

Link copied to clipboard

Get whether the value referenced by @value is null.

Link copied to clipboard

Get whether the value referenced by @value is a number.

Link copied to clipboard

Get whether the value referenced by @value is an object.

Link copied to clipboard

Get whether the value referenced by @value is a string

Link copied to clipboard

Determines whether a value is a typed array.

Link copied to clipboard

Get whether the value referenced by @value is undefined.

Link copied to clipboard
fun newTypedArrayWithBuffer(type: TypedArrayType, offset: <Error class: unknown class>, length: Long): Value

Create a new typed array value with elements from an array buffer.

Link copied to clipboard
fun objectDefinePropertyData(propertyName: String, flags: ValuePropertyFlags, propertyValue: Value? = null)

Define or modify a property with @property_name in object referenced by @value. This is equivalent to JavaScript Object.defineProperty() when used with a data descriptor.

Link copied to clipboard

Try to delete property with @name from @value. This function will return false if the property was defined without %JSC_VALUE_PROPERTY_CONFIGURABLE flag.

Link copied to clipboard

Get the list of property names of @value. Only properties defined with %JSC_VALUE_PROPERTY_ENUMERABLE flag will be collected.

Link copied to clipboard

Get property with @name from @value.

Link copied to clipboard
fun objectGetPropertyAtIndex(index: <Error class: unknown class>): Value

Get property at @index from @value.

Link copied to clipboard

Get whether @value has property with @name.

Link copied to clipboard

Get whether the value referenced by @value is an instance of class @name.

Link copied to clipboard
fun objectSetProperty(name: String, property: Value)

Set @property with @name on @value.

Link copied to clipboard
fun objectSetPropertyAtIndex(index: <Error class: unknown class>, property: Value)

Set @property at @index on @value.

Link copied to clipboard

Convert @value to a boolean.

Link copied to clipboard
fun toDouble(): <Error class: unknown class>

Convert @value to a double.

Link copied to clipboard
fun toInt32(): <Error class: unknown class>

Convert @value to a #gint32.

Link copied to clipboard
fun toJson(indent: <Error class: unknown class>): String

Create a JSON string of @value serialization. If @indent is 0, the resulting JSON will not contain newlines. The size of the indent is clamped to 10 spaces.

Link copied to clipboard
open override fun toString(): String

Convert @value to a string. Use jsc_value_to_string_as_bytes() instead, if you need to handle strings containing null characters.

Link copied to clipboard
fun toStringAsBytes(): <Error class: unknown class>

Convert @value to a string and return the results as #GBytes. This is needed to handle strings with null characters.

Link copied to clipboard

Obtain the %ArrayBuffer for the memory region of the typed array elements.

Link copied to clipboard
fun typedArrayGetLength(): <Error class: unknown class>

Gets the number of elements in a typed array.

Link copied to clipboard
fun typedArrayGetOffset(): <Error class: unknown class>

Gets the offset over the underlying array buffer data.

Link copied to clipboard
fun typedArrayGetSize(): <Error class: unknown class>

Gets the size of a typed array.

Link copied to clipboard

Gets the type of elements contained in a typed array.