class JavaScriptCore::Value
- JavaScriptCore::Value
- GObject::Object
- Reference
- Object
Defined in:
lib/gi-crystal/src/auto/java_script_core-5.0/value.crbindings/alias.cr
Constructors
-
.new
Initialize a new
Value
. - .new(*, context : JavaScriptCore::Context? = nil)
-
.new_array_from_garray(context : JavaScriptCore::Context, array : Enumerable(JavaScriptCore::Value)?) : self
Create a new #JSCValue referencing an array with the items from @array.
-
.new_array_from_strv(context : JavaScriptCore::Context, strv : Enumerable(String)) : self
Create a new #JSCValue referencing an array of strings with the items from @strv.
-
.new_boolean(context : JavaScriptCore::Context, value : Bool) : self
Create a new #JSCValue from @value
-
.new_from_json(context : JavaScriptCore::Context, json : String) : self
Create a new #JSCValue referencing a new value created by parsing @json.
-
.new_function(context : JavaScriptCore::Context, name : String?, callback : GObject::Callback, user_data : Pointer(Void)?, destroy_notify : GLib::DestroyNotify?, return_type : UInt64, parameter_types : Enumerable(UInt64)?) : self
Create a function in @context.
-
.new_function_variadic(context : JavaScriptCore::Context, name : String?, callback : GObject::Callback, user_data : Pointer(Void)?, destroy_notify : GLib::DestroyNotify?, return_type : UInt64) : self
Create a function in @context.
-
.new_null(context : JavaScriptCore::Context) : self
Create a new #JSCValue referencing
null in @context. -
.new_number(context : JavaScriptCore::Context, number : Float64) : self
Create a new #JSCValue from @number.
-
.new_object(context : JavaScriptCore::Context, instance : Pointer(Void)?, jsc_class : JavaScriptCore::Class?) : self
Create a new #JSCValue from @instance.
-
.new_string(context : JavaScriptCore::Context, string : String?) : self
Create a new #JSCValue from @string.
-
.new_string_from_bytes(context : JavaScriptCore::Context, bytes : GLib::Bytes?) : self
Create a new #JSCValue from @bytes.
-
.new_undefined(context : JavaScriptCore::Context) : self
Create a new #JSCValue referencing
undefined in @context.
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
-
#constructor_call(parameters : Enumerable(JavaScriptCore::Value)?) : JavaScriptCore::Value
Invoke
new with constructor referenced by @value. - #constructor_call(*parameters : JavaScriptCore::Value)
-
#context : JavaScriptCore::Context
Get the #JSCContext in which @value was created.
- #context=(value : JavaScriptCore::Context?) : JavaScriptCore::Context?
-
#function_call(parameters : Enumerable(JavaScriptCore::Value)?) : JavaScriptCore::Value
Call function referenced by @value, passing the given parameters.
- #function_call(*parameters : JavaScriptCore::Value)
-
#is_array : Bool
Get whether the value referenced by @value is an array.
-
#is_boolean : Bool
Get whether the value referenced by @value is a boolean.
-
#is_constructor : Bool
Get whether the value referenced by @value is a constructor.
-
#is_function : Bool
Get whether the value referenced by @value is a function
-
#is_null : Bool
Get whether the value referenced by @value is
null . -
#is_number : Bool
Get whether the value referenced by @value is a number.
-
#is_object : Bool
Get whether the value referenced by @value is an object.
-
#is_string : Bool
Get whether the value referenced by @value is a string
-
#is_undefined : Bool
Get whether the value referenced by @value is
undefined . -
#object_define_property_accessor(property_name : String, flags : JavaScriptCore::ValuePropertyFlags, property_type : UInt64, getter : GObject::Callback?, setter : GObject::Callback?) : Nil
Define or modify a property with @property_name in object referenced by @value.
-
#object_define_property_data(property_name : String, flags : JavaScriptCore::ValuePropertyFlags, property_value : JavaScriptCore::Value?) : Nil
Define or modify a property with @property_name in object referenced by @value.
-
#object_delete_property(name : String) : Bool
Try to delete property with @name from @value.
-
#object_enumerate_properties : Enumerable(String)?
Get the list of property names of @value.
-
#object_get_property(name : String) : JavaScriptCore::Value
Get property with @name from @value.
-
#object_get_property_at_index(index : UInt32) : JavaScriptCore::Value
Get property at @index from @value.
-
#object_has_property(name : String) : Bool
Get whether @value has property with @name.
-
#object_invoke_method(name : String, parameters : Enumerable(JavaScriptCore::Value)?) : JavaScriptCore::Value
Invoke method with @name on object referenced by @value, passing the given parameters.
-
#object_is_instance_of(name : String) : Bool
Get whether the value referenced by @value is an instance of class @name.
-
#object_set_property(name : String, property : JavaScriptCore::Value) : Nil
Set @property with @name on @value.
-
#object_set_property_at_index(index : UInt32, property : JavaScriptCore::Value) : Nil
Set @property at @index on @value.
-
#to_bool : Bool
Same as
.to_boolean
. -
#to_boolean : Bool
Convert @value to a boolean.
-
#to_double : Float64
Convert @value to a double.
-
#to_f : Float64
Same as
.to_double
. -
#to_i : Int32
Same as
.to_int32
. -
#to_int32 : Int32
Convert @value to a #gint32.
-
#to_json(indent : UInt32) : String
Create a JSON string of @value serialization.
-
#to_s : String
Same as
.to_string
. -
#to_string : String
Convert @value to a string.
-
#to_string_as_bytes : GLib::Bytes
Convert @value to a string and return the results as #GBytes.
Instance methods inherited from class GObject::Object
bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding
bind_property,
bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding
bind_property_full,
data(key : String) : Pointer(Void)?
data,
finalize
finalize,
freeze_notify : Nil
freeze_notify,
getv(names : Enumerable(String), values : Enumerable(_)) : Nil
getv,
notify(property_name : String) : Nil
notify,
notify_by_pspec(pspec : GObject::ParamSpec) : Nil
notify_by_pspec,
notify_signal
notify_signal,
property(property_name : String, value : _) : Nil
property,
qdata(quark : UInt32) : Pointer(Void)?
qdata,
ref_count : UInt32
ref_count,
run_dispose : Nil
run_dispose,
set_data(key : String, data : Pointer(Void)?) : Nil
set_data,
set_property(property_name : String, value : _) : Nil
set_property,
steal_data(key : String) : Pointer(Void)?
steal_data,
steal_qdata(quark : UInt32) : Pointer(Void)?
steal_qdata,
thaw_notify : Nil
thaw_notify,
to_unsafe : Pointer(Void)
to_unsafe,
watch_closure(closure : GObject::Closure) : Nil
watch_closure
Constructor methods inherited from class GObject::Object
cast(obj : GObject::Object) : self
cast,
cast?(obj : GObject::Object) : self?
cast?,
new(pointer : Pointer(Void), transfer : GICrystal::Transfer)new new, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv
Class methods inherited from class GObject::Object
compat_control(what : UInt64, data : Pointer(Void)?) : UInt64
compat_control,
g_type : UInt64
g_type,
interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec
interface_find_property,
interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec)
interface_list_properties
Constructor Detail
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.
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.
Create a new #JSCValue from @value
Create a new #JSCValue referencing a new value created by parsing @json.
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 the function parameters and then @user_data as last parameter. When the function is cleared in @context, @destroy_notify is called with @user_data as parameter.
Note that the value returned by @callback must be fully transferred. In case of boxed types, you could use %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used. If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created with jsc_value_new_object() that receives the copy as instance parameter.
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.
Note that the value returned by @callback must be fully transferred. In case of boxed types, you could use %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used. If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created with jsc_value_new_object() that receives the copy as instance parameter.
Create a new #JSCValue referencing
Create a new #JSCValue from @number.
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 @instance that will be freed by the #GDestroyNotify passed to jsc_context_register_class().
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.
Create a new #JSCValue from @bytes.
Create a new #JSCValue referencing
Class Method Detail
Instance Method Detail
Invoke
Call function referenced by @value, passing the given parameters. If @first_parameter_type is %G_TYPE_NONE no parameters will be passed to the function.
This function always returns a #JSCValue, in case of void functions a #JSCValue referencing
Define or modify a property with @property_name in object referenced by @value. When the
property value needs to be getted or set, @getter and @setter callbacks will be called.
When the property is cleared in the #JSCClass context, @destroy_notify is called with
@user_data as parameter. This is equivalent to JavaScript
Note that the value returned by @getter must be fully transferred. In case of boxed types, you could use %G_TYPE_POINTER instead of the actual boxed #GType to ensure that the instance owned by #JSCClass is used. If you really want to return a new copy of the boxed type, use #JSC_TYPE_VALUE and return a #JSCValue created with jsc_value_new_object() that receives the copy as instance parameter.
Note that @getter and @setter are called as functions and not methods, so they don't receive an instance as first parameter. Use jsc_class_add_property() if you want to add property accessor invoked as a method.
Define or modify a property with @property_name in object referenced by @value. This is equivalent to
JavaScript
Try to delete property with @name from @value. This function will return %FALSE if the property was defined without %JSC_VALUE_PROPERTY_CONFIGURABLE flag.
Get the list of property names of @value. Only properties defined with %JSC_VALUE_PROPERTY_ENUMERABLE flag will be collected.
Get property with @name from @value.
Get property at @index from @value.
Invoke method with @name on object referenced by @value, passing the given parameters. If @first_parameter_type is %G_TYPE_NONE no parameters will be passed to the method. The object instance will be handled automatically even when the method is a custom one registered with jsc_class_add_method(), so it should never be passed explicitly as parameter of this function.
This function always returns a #JSCValue, in case of void methods a #JSCValue referencing
Get whether the value referenced by @value is an instance of class @name.
Set @property with @name on @value.
Set @property at @index on @value.
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.
Convert @value to a string. Use jsc_value_to_string_as_bytes() instead, if you need to handle strings containing null characters.
Convert @value to a string and return the results as #GBytes. This is needed to handle strings with null characters.