javascriptcore.value

Module for [Value] class

Types 3

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

Methods
GType _gType() @property
Value self()Returns `this`, for use in `with` statements.
ValueGidBuilder builder()Get builder for [javascriptcore.value.Value] Returns: New builder object
javascriptcore.context.Context context() @propertyGet `context` property. Returns: The #JSCContext in which the value was created.
javascriptcore.value.Value newArrayBuffer(javascriptcore.context.Context context, void * data, size_t size, glib.types.DestroyNotify destroyNotify = null)Creates a new `ArrayBuffer` from existing data in memory.
javascriptcore.value.Value newArrayFromGarray(javascriptcore.context.Context context, javascriptcore.value.Value[] array = null)Create a new #JSCValue referencing an array with the items from array. If array is null or empty a new empty array will be created. Elements of array should be pointers to a #JSCValue.
javascriptcore.value.Value newArrayFromStrv(javascriptcore.context.Context context, string[] strv)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.
javascriptcore.value.Value newBoolean(javascriptcore.context.Context context, bool value)Create a new #JSCValue from value
javascriptcore.value.Value newFromJson(javascriptcore.context.Context context, string json)Create a new #JSCValue referencing a new value created by parsing json.
javascriptcore.value.Value newNull(javascriptcore.context.Context context)Create a new #JSCValue referencing <function>null</function> in context.
javascriptcore.value.Value newNumber(javascriptcore.context.Context context, double number)Create a new #JSCValue from number.
javascriptcore.value.Value newObject(javascriptcore.context.Context context, void * instance = null, javascriptcore.class_.Class jscClass = null)Create a new #JSCValue from instance. If instance is null a new empty object is created. When instance is provided, jscclass must be provided too. jscclass takes ownership of instance that will be ...
javascriptcore.value.Value newPromise(javascriptcore.context.Context context, javascriptcore.types.Executor executor)Creates a new Promise. executor will be invoked during promise initialization and it receives the resolve and reject objects than can be called to resolve or reject the promise. It is called like a...
javascriptcore.value.Value newString(javascriptcore.context.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 [javascriptcore.value.Value.newStringFromBytes] instead.
javascriptcore.value.Value newStringFromBytes(javascriptcore.context.Context context, glib.bytes.Bytes bytes = null)Create a new #JSCValue from bytes.
javascriptcore.value.Value newTypedArray(javascriptcore.context.Context context, javascriptcore.types.TypedArrayType type, size_t length)Create a new typed array containing a given amount of elements.
javascriptcore.value.Value newUndefined(javascriptcore.context.Context context)Create a new #JSCValue referencing <function>undefined</function> in context.
size_t arrayBufferGetSize()Gets the size in bytes of the array buffer.
javascriptcore.value.Value constructorCall(javascriptcore.value.Value[] parameters = null)Invoke <function>new</function> with constructor referenced by value. If n_parameters is 0 no parameters will be passed to the constructor.
javascriptcore.value.Value functionCall(javascriptcore.value.Value[] parameters = null)Call function referenced by value, passing the given parameters. If n_parameters is 0 no parameters will be passed to the function.
javascriptcore.context.Context getContext()Get the #JSCContext in which value was created. Returns: the #JSCValue context.
bool isArray()Get whether the value referenced by value is an array. Returns: whether the value is an array.
bool isArrayBuffer()Check whether the value is an `ArrayBuffer`. Returns: whether the value is an `ArrayBuffer`
bool isBoolean()Get whether the value referenced by value is a boolean. Returns: whether the value is a boolean.
bool isConstructor()Get whether the value referenced by value is a constructor. Returns: whether the value is a constructor.
bool isFunction()Get whether the value referenced by value is a function Returns: whether the value is a function.
bool isNull()Get whether the value referenced by value is <function>null</function>. Returns: whether the value is null.
bool isNumber()Get whether the value referenced by value is a number. Returns: whether the value is a number.
bool isObject()Get whether the value referenced by value is an object. Returns: whether the value is an object.
bool isString()Get whether the value referenced by value is a string Returns: whether the value is a string
bool isTypedArray()Determines whether a value is a typed array. Returns: Whether value is a typed array.
bool isUndefined()Get whether the value referenced by value is <function>undefined</function>. Returns: whether the value is undefined.
javascriptcore.value.Value newTypedArrayWithBuffer(javascriptcore.types.TypedArrayType type, size_t offset, ptrdiff_t length)Create a new typed array value with elements from an array buffer.
void objectDefinePropertyData(string propertyName, javascriptcore.types.ValuePropertyFlags flags, javascriptcore.value.Value propertyValue = null)Define or modify a property with property_name in object referenced by value. This is equivalent to JavaScript <function>Object.defineProperty()</function> when used with a data descriptor.
bool objectDeleteProperty(string name)Try to delete property with name from value. This function will return false if the property was defined without `JSCVALUEPROPERTY_CONFIGURABLE` flag.
string[] objectEnumerateProperties()Get the list of property names of value. Only properties defined with `JSCVALUEPROPERTY_ENUMERABLE` flag will be collected. Returns: a null-terminated array of strings containing the property names...
javascriptcore.value.Value objectGetProperty(string name)Get property with name from value.
javascriptcore.value.Value objectGetPropertyAtIndex(uint index)Get property at index from value.
bool objectHasProperty(string name)Get whether value has property with name.
javascriptcore.value.Value objectInvokeMethod(string name, javascriptcore.value.Value[] parameters = null)Invoke method with name on object referenced by value, passing the given parameters. If nparameters is 0 no parameters will be passed to the method. The object instance will be handled automaticall...
bool objectIsInstanceOf(string name)Get whether the value referenced by value is an instance of class name.
void objectSetProperty(string name, javascriptcore.value.Value property)Set property with name on value.
void objectSetPropertyAtIndex(uint index, javascriptcore.value.Value property)Set property at index on value.
bool toBoolean()Convert value to a boolean. Returns: a #gboolean result of the conversion.
double toDouble()Convert value to a double. Returns: a #gdouble result of the conversion.
int toInt32()Convert value to a #gint32. Returns: a #gint32 result of the conversion.
string toJson(uint indent)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.
string toString_()Convert value to a string. Use [javascriptcore.value.Value.toStringAsBytes] instead, if you need to handle strings containing null characters. Returns: a null-terminated string result of the conver...
glib.bytes.Bytes toStringAsBytes()Convert value to a string and return the results as #GBytes. This is needed to handle strings with null characters. Returns: a #GBytes with the result of the conversion.
javascriptcore.value.Value typedArrayGetBuffer()Obtain the `ArrayBuffer` for the memory region of the typed array elements. Returns: A #JSCValue
void * typedArrayGetData(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. If length is not null, the number of elements conta...
size_t typedArrayGetLength()Gets the number of elements in a typed array. Returns: number of elements.
size_t typedArrayGetOffset()Gets the offset over the underlying array buffer data. Returns: offset, in bytes.
size_t typedArrayGetSize()Gets the size of a typed array. Returns: size, in bytes.
javascriptcore.types.TypedArrayType typedArrayGetType()Gets the type of elements contained in a typed array. Returns: type of the elements, or `JSCTYPEDARRAY_NONE` if value is not a typed array.
Constructors
this(void * ptr, Flag!"Take" take)
Methods
T context(javascriptcore.context.Context propval)Set `context` property. Params: propval = The #JSCContext in which the value was created. Returns: Builder instance for fluent chaining

Fluent builder for [javascriptcore.value.Value]

Methods