javascriptcore

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Package javascriptcore was automatically generated by github.com/jwijenbergh/puregotk DO NOT EDIT

Index

Constants

View Source
const (
	// Allows the DFG JIT to be used if %TRUE.
	// Option type: %JSC_OPTION_BOOLEAN
	// Default value: %TRUE.
	OPTIONS_USE_DFG string = "useDFGJIT"
	// Allows the FTL JIT to be used if %TRUE.
	// Option type: %JSC_OPTION_BOOLEAN
	// Default value: %TRUE.
	OPTIONS_USE_FTL string = "useFTLJIT"
	// Allows the executable pages to be allocated for JIT and thunks if %TRUE.
	// Option type: %JSC_OPTION_BOOLEAN
	// Default value: %TRUE.
	OPTIONS_USE_JIT string = "useJIT"
	// Allows the LLINT to be used if %TRUE.
	// Option type: %JSC_OPTION_BOOLEAN
	// Default value: %TRUE.
	OPTIONS_USE_LLINT string = "useLLInt"
)
View Source
const (
	// Like jsc_get_major_version(), but from the headers used at
	// application compile time, rather than from the library linked
	// against at application run time.
	MAJOR_VERSION int = 2
	// Like jsc_get_micro_version(), but from the headers used at
	// application compile time, rather than from the library linked
	// against at application run time.
	MICRO_VERSION int = 3
	// Like jsc_get_minor_version(), but from the headers used at
	// application compile time, rather than from the library linked
	// against at application run time.
	MINOR_VERSION int = 50
)

Variables

This section is empty.

Functions

func ClassGLibType

func ClassGLibType() types.GType

func ContextGLibType

func ContextGLibType() types.GType

func ExceptionGLibType

func ExceptionGLibType() types.GType

func GetMajorVersion

func GetMajorVersion() uint

Returns the major version number of the JavaScriptCore library. (e.g. in JavaScriptCore version 1.8.3 this is 1.)

This function is in the library, so it represents the JavaScriptCore library your code is running against. Contrast with the #JSC_MAJOR_VERSION macro, which represents the major version of the JavaScriptCore headers you have included when compiling your code.

func GetMicroVersion

func GetMicroVersion() uint

Returns the micro version number of the JavaScriptCore library. (e.g. in JavaScriptCore version 1.8.3 this is 3.)

This function is in the library, so it represents the JavaScriptCore library your code is running against. Contrast with the #JSC_MICRO_VERSION macro, which represents the micro version of the JavaScriptCore headers you have included when compiling your code.

func GetMinorVersion

func GetMinorVersion() uint

Returns the minor version number of the JavaScriptCore library. (e.g. in JavaScriptCore version 1.8.3 this is 8.)

This function is in the library, so it represents the JavaScriptCore library your code is running against. Contrast with the #JSC_MINOR_VERSION macro, which represents the minor version of the JavaScriptCore headers you have included when compiling your code.

func OptionsForeach

func OptionsForeach(FunctionVar *OptionsFunc, UserDataVar uintptr)

Iterates all available options calling @function for each one. Iteration can stop early if @function returns %FALSE.

func OptionsGetBoolean

func OptionsGetBoolean(OptionVar string, ValueVar *bool) bool

Get @option as a #gboolean value.

func OptionsGetDouble

func OptionsGetDouble(OptionVar string, ValueVar *float64) bool

Get @option as a #gdouble value.

func OptionsGetInt

func OptionsGetInt(OptionVar string, ValueVar *int) bool

Get @option as a #gint value.

func OptionsGetOptionGroup

func OptionsGetOptionGroup() *glib.OptionGroup

Create a #GOptionGroup to handle JSCOptions as command line arguments. The options will be exposed as command line arguments with the form <emphasis>--jsc-<option>=<value></emphasis>. Each entry in the returned #GOptionGroup is configured to apply the corresponding option during command line parsing. Applications only need to pass the returned group to g_option_context_add_group(), and the rest will be taken care for automatically.

func OptionsGetRangeString

func OptionsGetRangeString(OptionVar string, ValueVar *string) bool

Get @option as a range string. The string must be in the format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values. Values between low and high (both included) will be considered in the range, unless <emphasis>!</emphasis> is used to invert the range.

func OptionsGetSize

func OptionsGetSize(OptionVar string, ValueVar *uint) bool

Get @option as a #gsize value.

func OptionsGetString

func OptionsGetString(OptionVar string, ValueVar *string) bool

Get @option as a string.

func OptionsGetUint

func OptionsGetUint(OptionVar string, ValueVar *uint) bool

Get @option as a #guint value.

func OptionsSetBoolean

func OptionsSetBoolean(OptionVar string, ValueVar bool) bool

Set @option as a #gboolean value.

func OptionsSetDouble

func OptionsSetDouble(OptionVar string, ValueVar float64) bool

Set @option as a #gdouble value.

func OptionsSetInt

func OptionsSetInt(OptionVar string, ValueVar int) bool

Set @option as a #gint value.

func OptionsSetRangeString

func OptionsSetRangeString(OptionVar string, ValueVar string) bool

Set @option as a range string. The string must be in the format <emphasis>[!]<low>[:<high>]</emphasis> where low and high are #guint values. Values between low and high (both included) will be considered in the range, unless <emphasis>!</emphasis> is used to invert the range.

func OptionsSetSize

func OptionsSetSize(OptionVar string, ValueVar uint) bool

Set @option as a #gsize value.

func OptionsSetString

func OptionsSetString(OptionVar string, ValueVar string) bool

Set @option as a string.

func OptionsSetUint

func OptionsSetUint(OptionVar string, ValueVar uint) bool

Set @option as a #guint value.

func ValueGLibType

func ValueGLibType() types.GType

func VirtualMachineGLibType

func VirtualMachineGLibType() types.GType

func WeakValueGLibType

func WeakValueGLibType() types.GType

Types

type CheckSyntaxMode

type CheckSyntaxMode int

Enum values to specify a mode to check for syntax errors in jsc_context_check_syntax().

const (

	// mode to check syntax of a script
	JscCheckSyntaxModeScriptValue CheckSyntaxMode = 0
	// mode to check syntax of a module
	JscCheckSyntaxModeModuleValue CheckSyntaxMode = 1
)

type CheckSyntaxResult

type CheckSyntaxResult int

Enum values to specify the result of jsc_context_check_syntax().

const (

	// no errors
	JscCheckSyntaxResultSuccessValue CheckSyntaxResult = 0
	// recoverable syntax error
	JscCheckSyntaxResultRecoverableErrorValue CheckSyntaxResult = 1
	// irrecoverable syntax error
	JscCheckSyntaxResultIrrecoverableErrorValue CheckSyntaxResult = 2
	// unterminated literal error
	JscCheckSyntaxResultUnterminatedLiteralErrorValue CheckSyntaxResult = 3
	// out of memory error
	JscCheckSyntaxResultOutOfMemoryErrorValue CheckSyntaxResult = 4
	// stack overflow error
	JscCheckSyntaxResultStackOverflowErrorValue CheckSyntaxResult = 5
)

type Class

type Class struct {
	gobject.Object
}

A JSSClass represents a custom JavaScript class registered by the user in a #JSCContext. It allows to create new JavaScripts objects whose instances are created by the user using this API. It's possible to add constructors, properties and methods for a JSSClass by providing #GCallback<!-- -->s to implement them.

func ClassNewFromInternalPtr

func ClassNewFromInternalPtr(ptr uintptr) *Class

func (*Class) AddConstructor

func (x *Class) AddConstructor(NameVar *string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType, NParamsVar uint, varArgs ...interface{}) *Value

Add a constructor to @jsc_class. If @name is %NULL, the class name will be used. When <function>new</function> is used with the constructor or jsc_value_constructor_call() is called, @callback is invoked receiving the parameters and @user_data as the last parameter. When the constructor object is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use jsc_context_set_value() to make the constructor available in the global object.

Note that the value returned by @callback is adopted by @jsc_class, and the #GDestroyNotify passed to jsc_context_register_class() is responsible for disposing of it.

func (*Class) AddConstructorVariadic

func (x *Class) AddConstructorVariadic(NameVar *string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType) *Value

Add a constructor to @jsc_class. If @name is %NULL, the class name will be used. When <function>new</function> is used with the constructor or jsc_value_constructor_call() is called, @callback is invoked receiving a #GPtrArray of #JSCValue<!-- -->s as arguments and @user_data as the last parameter. When the constructor object is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use jsc_context_set_value() to make the constructor available in the global object.

Note that the value returned by @callback is adopted by @jsc_class, and the #GDestroyNotify passed to jsc_context_register_class() is responsible for disposing of it.

func (*Class) AddConstructorv

func (x *Class) AddConstructorv(NameVar *string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType, NParametersVar uint, ParameterTypesVar []types.GType) *Value

Add a constructor to @jsc_class. If @name is %NULL, the class name will be used. When <function>new</function> is used with the constructor or jsc_value_constructor_call() is called, @callback is invoked receiving the parameters and @user_data as the last parameter. When the constructor object is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

This function creates the constructor, which needs to be added to an object as a property to be able to use it. Use jsc_context_set_value() to make the constructor available in the global object.

Note that the value returned by @callback is adopted by @jsc_class, and the #GDestroyNotify passed to jsc_context_register_class() is responsible for disposing of it.

func (*Class) AddMethod

func (x *Class) AddMethod(NameVar string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType, NParamsVar uint, varArgs ...interface{})

Add method with @name to @jsc_class. When the method is called by JavaScript or jsc_value_object_invoke_method(), @callback is called receiving the class instance as first parameter, followed by the method parameters and then @user_data as last parameter. When the method is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

Note that the value returned by @callback must be transfer full. In case of non-refcounted boxed types, you should 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 the instance parameter.

func (*Class) AddMethodVariadic

func (x *Class) AddMethodVariadic(NameVar string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType)

Add method with @name to @jsc_class. When the method is called by JavaScript or jsc_value_object_invoke_method(), @callback is called receiving the class instance as first parameter, followed by a #GPtrArray of #JSCValue<!-- -->s with the method arguments and then @user_data as last parameter. When the method is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

Note that the value returned by @callback must be transfer full. In case of non-refcounted boxed types, you should 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 the instance parameter.

func (*Class) AddMethodv

func (x *Class) AddMethodv(NameVar string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType, NParametersVar uint, ParameterTypesVar []types.GType)

Add method with @name to @jsc_class. When the method is called by JavaScript or jsc_value_object_invoke_method(), @callback is called receiving the class instance as first parameter, followed by the method parameters and then @user_data as last parameter. When the method is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

Note that the value returned by @callback must be transfer full. In case of non-refcounted boxed types, you should 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 the instance parameter.

func (*Class) AddProperty

func (x *Class) AddProperty(NameVar string, PropertyTypeVar types.GType, GetterVar *gobject.Callback, SetterVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify)

Add a property with @name to @jsc_class. When the property value needs to be getted, @getter is called receiving the the class instance as first parameter and @user_data as last parameter. When the property value needs to be set, @setter is called receiving the the class instance as first parameter, followed by the value to be set and then @user_data as the last parameter. When the property is cleared in the #JSCClass context, @destroy_notify is called with @user_data as parameter.

Note that the value returned by @getter must be transfer full. In case of non-refcounted boxed types, you should 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 the instance parameter.

func (*Class) GetName

func (x *Class) GetName() string

Get the class name of @jsc_class

func (*Class) GetParent

func (x *Class) GetParent() *Class

Get the parent class of @jsc_class

func (*Class) GetPropertyName added in v0.0.4

func (x *Class) GetPropertyName() string

GetPropertyName gets the "name" property. The name of the class.

func (*Class) GoPointer

func (c *Class) GoPointer() uintptr

func (*Class) SetGoPointer

func (c *Class) SetGoPointer(ptr uintptr)

func (*Class) SetPropertyName added in v0.0.4

func (x *Class) SetPropertyName(value string)

SetPropertyName sets the "name" property. The name of the class.

type ClassClass

type ClassClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ClassClass) GoPointer

func (x *ClassClass) GoPointer() uintptr

type ClassDeletePropertyFunction

type ClassDeletePropertyFunction func(uintptr, uintptr, uintptr, string) bool

The type of delete_property in #JSCClassVTable. This is only required when you need to handle external properties not added to the prototype.

type ClassEnumeratePropertiesFunction

type ClassEnumeratePropertiesFunction func(uintptr, uintptr, uintptr) []string

The type of enumerate_properties in #JSCClassVTable. This is only required when you need to handle external properties not added to the prototype.

type ClassGetPropertyFunction

type ClassGetPropertyFunction func(uintptr, uintptr, uintptr, string) uintptr

The type of get_property in #JSCClassVTable. This is only required when you need to handle external properties not added to the prototype.

type ClassHasPropertyFunction

type ClassHasPropertyFunction func(uintptr, uintptr, uintptr, string) bool

The type of has_property in #JSCClassVTable. This is only required when you need to handle external properties not added to the prototype.

type ClassSetPropertyFunction

type ClassSetPropertyFunction func(uintptr, uintptr, uintptr, string, uintptr) bool

The type of set_property in #JSCClassVTable. This is only required when you need to handle external properties not added to the prototype.

type ClassVTable

type ClassVTable struct {
	GetProperty ClassGetPropertyFunction

	SetProperty ClassSetPropertyFunction

	HasProperty ClassHasPropertyFunction

	DeleteProperty ClassDeletePropertyFunction

	EnumerateProperties ClassEnumeratePropertiesFunction
	// contains filtered or unexported fields
}

Virtual table for a JSCClass. This can be optionally used when registering a #JSCClass in a #JSCContext to provide a custom implementation for the class. All virtual functions are optional and can be set to %NULL to fallback to the default implementation.

func (*ClassVTable) GetJscReserved0

func (x *ClassVTable) GetJscReserved0() func()

GetJscReserved0 gets the "_jsc_reserved0" callback function.

func (*ClassVTable) GetJscReserved1

func (x *ClassVTable) GetJscReserved1() func()

GetJscReserved1 gets the "_jsc_reserved1" callback function.

func (*ClassVTable) GetJscReserved2

func (x *ClassVTable) GetJscReserved2() func()

GetJscReserved2 gets the "_jsc_reserved2" callback function.

func (*ClassVTable) GetJscReserved3

func (x *ClassVTable) GetJscReserved3() func()

GetJscReserved3 gets the "_jsc_reserved3" callback function.

func (*ClassVTable) GetJscReserved4

func (x *ClassVTable) GetJscReserved4() func()

GetJscReserved4 gets the "_jsc_reserved4" callback function.

func (*ClassVTable) GetJscReserved5

func (x *ClassVTable) GetJscReserved5() func()

GetJscReserved5 gets the "_jsc_reserved5" callback function.

func (*ClassVTable) GetJscReserved6

func (x *ClassVTable) GetJscReserved6() func()

GetJscReserved6 gets the "_jsc_reserved6" callback function.

func (*ClassVTable) GetJscReserved7

func (x *ClassVTable) GetJscReserved7() func()

GetJscReserved7 gets the "_jsc_reserved7" callback function.

func (*ClassVTable) GoPointer

func (x *ClassVTable) GoPointer() uintptr

func (*ClassVTable) OverrideJscReserved0

func (x *ClassVTable) OverrideJscReserved0(cb func())

OverrideJscReserved0 sets the "_jsc_reserved0" callback function.

func (*ClassVTable) OverrideJscReserved1

func (x *ClassVTable) OverrideJscReserved1(cb func())

OverrideJscReserved1 sets the "_jsc_reserved1" callback function.

func (*ClassVTable) OverrideJscReserved2

func (x *ClassVTable) OverrideJscReserved2(cb func())

OverrideJscReserved2 sets the "_jsc_reserved2" callback function.

func (*ClassVTable) OverrideJscReserved3

func (x *ClassVTable) OverrideJscReserved3(cb func())

OverrideJscReserved3 sets the "_jsc_reserved3" callback function.

func (*ClassVTable) OverrideJscReserved4

func (x *ClassVTable) OverrideJscReserved4(cb func())

OverrideJscReserved4 sets the "_jsc_reserved4" callback function.

func (*ClassVTable) OverrideJscReserved5

func (x *ClassVTable) OverrideJscReserved5(cb func())

OverrideJscReserved5 sets the "_jsc_reserved5" callback function.

func (*ClassVTable) OverrideJscReserved6

func (x *ClassVTable) OverrideJscReserved6(cb func())

OverrideJscReserved6 sets the "_jsc_reserved6" callback function.

func (*ClassVTable) OverrideJscReserved7

func (x *ClassVTable) OverrideJscReserved7(cb func())

OverrideJscReserved7 sets the "_jsc_reserved7" callback function.

type Context

type Context struct {
	gobject.Object
}

JSCContext represents a JavaScript execution context, where all operations take place and where the values will be associated.

When a new context is created, a global object is allocated and the built-in JavaScript objects (Object, Function, String, Array) are populated. You can execute JavaScript in the context by using jsc_context_evaluate() or jsc_context_evaluate_with_source_uri(). It's also possible to register custom objects in the context with jsc_context_register_class().

func ContextGetCurrent

func ContextGetCurrent() *Context

Get the #JSCContext that is currently executing a function. This should only be called within a function or method callback, otherwise %NULL will be returned.

func ContextNewFromInternalPtr

func ContextNewFromInternalPtr(ptr uintptr) *Context

func NewContext

func NewContext() *Context

Create a new #JSCContext. The context is created in a new #JSCVirtualMachine. Use jsc_context_new_with_virtual_machine() to create a new #JSCContext in an existing #JSCVirtualMachine.

func NewContextWithVirtualMachine

func NewContextWithVirtualMachine(VmVar *VirtualMachine) *Context

Create a new #JSCContext in @virtual_machine.

func (*Context) CheckSyntax

func (x *Context) CheckSyntax(CodeVar string, LengthVar int, ModeVar CheckSyntaxMode, UriVar string, LineNumberVar uint, ExceptionVar **Exception) CheckSyntaxResult

Check the given @code in @context for syntax errors. The @line_number is the starting line number in @uri; the value is one-based so the first line is 1. @uri and @line_number are only used to fill the @exception. In case of errors @exception will be set to a new #JSCException with the details. You can pass %NULL to @exception to ignore the error details.

func (*Context) ClearException

func (x *Context) ClearException()

Clear the uncaught exception in @context if any.

func (*Context) Evaluate

func (x *Context) Evaluate(CodeVar string, LengthVar int) *Value

Evaluate @code in @context.

func (*Context) EvaluateInObject

func (x *Context) EvaluateInObject(CodeVar string, LengthVar int, ObjectInstanceVar uintptr, ObjectClassVar *Class, UriVar string, LineNumberVar uint, ObjectVar **Value) *Value

Evaluate @code and create an new object where symbols defined in @code will be added as properties, instead of being added to @context global object. The new object is returned as @object parameter. Similar to how jsc_value_new_object() works, if @object_instance is not %NULL @object_class must be provided too. The @line_number is the starting line number in @uri; the value is one-based so the first line is 1. @uri and @line_number will be shown in exceptions and they don't affect the behavior of the script.

func (*Context) EvaluateWithSourceUri

func (x *Context) EvaluateWithSourceUri(CodeVar string, LengthVar int, UriVar string, LineNumberVar uint) *Value

Evaluate @code in @context using @uri as the source URI. The @line_number is the starting line number in @uri; the value is one-based so the first line is 1. @uri and @line_number will be shown in exceptions and they don't affect the behavior of the script.

func (*Context) GetException

func (x *Context) GetException() *Exception

Get the last unhandled exception thrown in @context by API functions calls.

func (*Context) GetGlobalObject

func (x *Context) GetGlobalObject() *Value

Get a #JSCValue referencing the @context global object

func (*Context) GetValue

func (x *Context) GetValue(NameVar string) *Value

Get a property of @context global object with @name.

func (*Context) GetVirtualMachine

func (x *Context) GetVirtualMachine() *VirtualMachine

Get the #JSCVirtualMachine where @context was created.

func (*Context) GoPointer

func (c *Context) GoPointer() uintptr

func (*Context) PopExceptionHandler

func (x *Context) PopExceptionHandler()

Remove the last #JSCExceptionHandler previously pushed to @context with jsc_context_push_exception_handler().

func (*Context) PushExceptionHandler

func (x *Context) PushExceptionHandler(HandlerVar *ExceptionHandler, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify)

Push an exception handler in @context. Whenever a JavaScript exception happens in the #JSCContext, the given @handler will be called. The default #JSCExceptionHandler simply calls jsc_context_throw_exception() to throw the exception to the #JSCContext. If you don't want to catch the exception, but only get notified about it, call jsc_context_throw_exception() in @handler like the default one does. The last exception handler pushed is the only one used by the #JSCContext, use jsc_context_pop_exception_handler() to remove it and set the previous one. When @handler is removed from the context, @destroy_notify i called with @user_data as parameter.

func (*Context) RegisterClass

func (x *Context) RegisterClass(NameVar string, ParentClassVar *Class, VtableVar *ClassVTable, DestroyNotifyVar *glib.DestroyNotify) *Class

Register a custom class in @context using the given @name. If the new class inherits from another #JSCClass, the parent should be passed as @parent_class, otherwise %NULL should be used. The optional @vtable parameter allows to provide a custom implementation for handling the class, for example, to handle external properties not added to the prototype. When an instance of the #JSCClass is cleared in the context, @destroy_notify is called with the instance as parameter.

func (*Context) SetGoPointer

func (c *Context) SetGoPointer(ptr uintptr)

func (*Context) SetValue

func (x *Context) SetValue(NameVar string, ValueVar *Value)

Set a property of @context global object with @name and @value.

func (*Context) Throw

func (x *Context) Throw(ErrorMessageVar string)

Throw an exception to @context using the given error message. The created #JSCException can be retrieved with jsc_context_get_exception().

func (*Context) ThrowException

func (x *Context) ThrowException(ExceptionVar *Exception)

Throw @exception to @context.

func (*Context) ThrowPrintf

func (x *Context) ThrowPrintf(FormatVar string, varArgs ...interface{})

Throw an exception to @context using the given formatted string as error message. The created #JSCException can be retrieved with jsc_context_get_exception().

func (*Context) ThrowWithName

func (x *Context) ThrowWithName(ErrorNameVar string, ErrorMessageVar string)

Throw an exception to @context using the given error name and message. The created #JSCException can be retrieved with jsc_context_get_exception().

func (*Context) ThrowWithNamePrintf

func (x *Context) ThrowWithNamePrintf(ErrorNameVar string, FormatVar string, varArgs ...interface{})

Throw an exception to @context using the given error name and the formatted string as error message. The created #JSCException can be retrieved with jsc_context_get_exception().

type ContextClass

type ContextClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ContextClass) GoPointer

func (x *ContextClass) GoPointer() uintptr

type Exception

type Exception struct {
	gobject.Object
}

JSCException represents a JavaScript exception.

func ExceptionNewFromInternalPtr

func ExceptionNewFromInternalPtr(ptr uintptr) *Exception

func NewException

func NewException(ContextVar *Context, MessageVar string) *Exception

Create a new #JSCException in @context with @message.

func NewExceptionPrintf

func NewExceptionPrintf(ContextVar *Context, FormatVar string, varArgs ...interface{}) *Exception

Create a new #JSCException in @context using a formatted string for the message.

func NewExceptionVprintf

func NewExceptionVprintf(ContextVar *Context, FormatVar string, ArgsVar []interface{}) *Exception

Create a new #JSCException in @context using a formatted string for the message. This is similar to jsc_exception_new_printf() except that the arguments to the format string are passed as a va_list.

func NewExceptionWithName

func NewExceptionWithName(ContextVar *Context, NameVar string, MessageVar string) *Exception

Create a new #JSCException in @context with @name and @message.

func NewExceptionWithNamePrintf

func NewExceptionWithNamePrintf(ContextVar *Context, NameVar string, FormatVar string, varArgs ...interface{}) *Exception

Create a new #JSCException in @context with @name and using a formatted string for the message.

func NewExceptionWithNameVprintf

func NewExceptionWithNameVprintf(ContextVar *Context, NameVar string, FormatVar string, ArgsVar []interface{}) *Exception

Create a new #JSCException in @context with @name and using a formatted string for the message. This is similar to jsc_exception_new_with_name_printf() except that the arguments to the format string are passed as a va_list.

func (*Exception) GetBacktraceString

func (x *Exception) GetBacktraceString() string

Get a string with the exception backtrace.

func (*Exception) GetColumnNumber

func (x *Exception) GetColumnNumber() uint

Get the column number at which @exception happened.

func (*Exception) GetLineNumber

func (x *Exception) GetLineNumber() uint

Get the line number at which @exception happened.

func (*Exception) GetMessage

func (x *Exception) GetMessage() string

Get the error message of @exception.

func (*Exception) GetName

func (x *Exception) GetName() string

Get the error name of @exception

func (*Exception) GetSourceUri

func (x *Exception) GetSourceUri() string

Get the source URI of @exception.

func (*Exception) GoPointer

func (c *Exception) GoPointer() uintptr

func (*Exception) Report

func (x *Exception) Report() string

Return a report message of @exception, containing all the possible details such us source URI, line, column and backtrace, and formatted to be printed.

func (*Exception) SetGoPointer

func (c *Exception) SetGoPointer(ptr uintptr)

func (*Exception) ToString

func (x *Exception) ToString() string

Get the string representation of @exception error.

type ExceptionClass

type ExceptionClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ExceptionClass) GoPointer

func (x *ExceptionClass) GoPointer() uintptr

type ExceptionHandler

type ExceptionHandler func(uintptr, uintptr, uintptr)

Function used to handle JavaScript exceptions in a #JSCContext.

type Executor

type Executor func(uintptr, uintptr, uintptr)

A function passed to @jsc_value_new_promise called during initialization

It is called like a JavaScript function, so exceptions raised will not be propagated to the context, but handled by the promise causing a rejection. @resolve and @reject can be reffed for later use to handle async task completion.

type OptionType

type OptionType int

Enum values for options types.

const (

	// A #gboolean option type.
	JscOptionBooleanValue OptionType = 0
	// A #gint option type.
	JscOptionIntValue OptionType = 1
	// A #guint option type.
	JscOptionUintValue OptionType = 2
	// A #gsize options type.
	JscOptionSizeValue OptionType = 3
	// A #gdouble options type.
	JscOptionDoubleValue OptionType = 4
	// A string option type.
	JscOptionStringValue OptionType = 5
	// A range string option type.
	JscOptionRangeStringValue OptionType = 6
)

type OptionsFunc

type OptionsFunc func(string, OptionType, string, uintptr) bool

Function used to iterate options.

Not that @description string is not localized.

type TypedArrayType

type TypedArrayType int

Possible types of the elements contained in a typed array.

const (

	// Not a typed array, or type unsupported.
	JscTypedArrayNoneValue TypedArrayType = 0
	// Array elements are 8-bit signed integers (int8_t).
	JscTypedArrayInt8Value TypedArrayType = 1
	// Array elements are 16-bit signed integers (int16_t).
	JscTypedArrayInt16Value TypedArrayType = 2
	// Array elements are 32-bit signed integers (int32_t).
	JscTypedArrayInt32Value TypedArrayType = 3
	// Array elements are 64-bit signed integers (int64_t).
	JscTypedArrayInt64Value TypedArrayType = 4
	// Array elements are 8-bit unsigned integers (uint8_t).
	JscTypedArrayUint8Value TypedArrayType = 5
	// Array elements are 8-bit unsigned integers (uint8_t).
	JscTypedArrayUint8ClampedValue TypedArrayType = 6
	// Array elements are 16-bit unsigned integers (uint16_t).
	JscTypedArrayUint16Value TypedArrayType = 7
	// Array elements are 32-bit unsigned integers (uint32_t).
	JscTypedArrayUint32Value TypedArrayType = 8
	// Array elements are 64-bit unsigned integers (uint64_t).
	JscTypedArrayUint64Value TypedArrayType = 9
	// Array elements are 32-bit floating point numbers (float).
	JscTypedArrayFloat32Value TypedArrayType = 10
	// Array elements are 64-bit floating point numbers (double).
	JscTypedArrayFloat64Value TypedArrayType = 11
)

type Value

type Value struct {
	gobject.Object
}

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

func NewValueArray

func NewValueArray(ContextVar *Context, FirstItemTypeVar types.GType, varArgs ...interface{}) *Value

Create a new #JSCValue referencing an array with the given items. If @first_item_type is %G_TYPE_NONE an empty array is created.

func NewValueArrayBuffer

func NewValueArrayBuffer(ContextVar *Context, DataVar uintptr, SizeVar uint, DestroyNotifyVar *glib.DestroyNotify, UserDataVar uintptr) *Value

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

The @data is not copied: while this allows sharing data with JavaScript efficiently, the caller must ensure that the memory region remains valid until the newly created object is released by JSC.

Optionally, a @destroy_notify callback can be provided, which will be invoked with @user_data as parameter when the %ArrayBuffer object is released. This is intended to be used for freeing resources related to the memory region which contains the data:

|[!<-- language="C" --> GMappedFile *f = g_mapped_file_new (file_path, TRUE, NULL); JSCValue *value = jsc_value_new_array_buffer (context,

g_mapped_file_get_contents (f), g_mapped_file_get_length (f),
(GDestroyNotify) g_mapped_file_unref, f);

]|

Note that the @user_data can be the same value as @data:

|[!<-- language="C" --> void *bytes = g_malloc0 (100); JSCValue *value = jsc_value_new_array_buffer (context, bytes, 100, g_free, bytes); ]|

func NewValueArrayFromGarray

func NewValueArrayFromGarray(ContextVar *Context, ArrayVar []Value) *Value

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.

func NewValueArrayFromStrv

func NewValueArrayFromStrv(ContextVar *Context, StrvVar []string) *Value

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.

func NewValueBoolean

func NewValueBoolean(ContextVar *Context, ValueVar bool) *Value

Create a new #JSCValue from @value

func NewValueFromJson

func NewValueFromJson(ContextVar *Context, JsonVar string) *Value

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

func NewValueFunction

func NewValueFunction(ContextVar *Context, NameVar *string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType, NParamsVar uint, varArgs ...interface{}) *Value

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.

func NewValueFunctionVariadic

func NewValueFunctionVariadic(ContextVar *Context, NameVar *string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType) *Value

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 #JSCValue<!-- -->s 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.

func NewValueFunctionv

func NewValueFunctionv(ContextVar *Context, NameVar *string, CallbackVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify, ReturnTypeVar types.GType, NParametersVar uint, ParameterTypesVar []types.GType) *Value

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.

func NewValueNull

func NewValueNull(ContextVar *Context) *Value

Create a new #JSCValue referencing <function>null</function> in @context.

func NewValueNumber

func NewValueNumber(ContextVar *Context, NumberVar float64) *Value

Create a new #JSCValue from @number.

func NewValueObject

func NewValueObject(ContextVar *Context, InstanceVar uintptr, JscClassVar *Class) *Value

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().

func NewValuePromise

func NewValuePromise(ContextVar *Context, ExecutorVar *Executor, UserDataVar uintptr) *Value

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 JavaScript function, so exceptions raised during the executor invocation will not be propagated to the context, but handled by the promise causing a rejection.

func NewValueString

func NewValueString(ContextVar *Context, StringVar *string) *Value

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.

func NewValueStringFromBytes

func NewValueStringFromBytes(ContextVar *Context, BytesVar *glib.Bytes) *Value

Create a new #JSCValue from @bytes.

func NewValueTypedArray

func NewValueTypedArray(ContextVar *Context, TypeVar TypedArrayType, LengthVar uint) *Value

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

Create a #JSCValue referencing a new typed array with space for @length elements of a given @type. As all typed arrays must have an associated `ArrayBuffer`, a new one of suitable size will be allocated to store the elements, which will be initialized to zero.

The @type must *not* be %JSC_TYPED_ARRAY_NONE.

func NewValueUndefined

func NewValueUndefined(ContextVar *Context) *Value

Create a new #JSCValue referencing <function>undefined</function> in @context.

func ValueNewFromInternalPtr

func ValueNewFromInternalPtr(ptr uintptr) *Value

func (*Value) ArrayBufferGetData

func (x *Value) ArrayBufferGetData(SizeVar *uint) uintptr

Gets a pointer to memory that contains the array buffer data.

Obtains a pointer to the memory region that holds the contents of the %ArrayBuffer; modifications done to the data will be visible to JavaScript code. If @size is not %NULL, the size in bytes of the memory region will also be stored in the pointed location.

Note that the pointer returned by this function is not guaranteed to remain the same after calls to other JSC API functions. If you plan to access the data of the %ArrayBuffer later, you can keep a reference to the @value and obtain the data pointer at a later point. Keep in mind that if JavaScript code has a chance to run, for example due to main loop events that result in JSC being called, the contents of the memory region might be modified in the meantime. Consider taking a copy of the data and using the copy instead in asynchronous code.

func (*Value) ArrayBufferGetSize

func (x *Value) ArrayBufferGetSize() uint

Gets the size in bytes of the array buffer.

Obtains the size in bytes of the memory region that holds the contents of an %ArrayBuffer.

func (*Value) ConstructorCall

func (x *Value) ConstructorCall(FirstParameterTypeVar types.GType, varArgs ...interface{}) *Value

Invoke <function>new</function> with constructor referenced by @value. If @first_parameter_type is %G_TYPE_NONE no parameters will be passed to the constructor.

func (*Value) ConstructorCallv

func (x *Value) ConstructorCallv(NParametersVar uint, ParametersVar []Value) *Value

Invoke <function>new</function> with constructor referenced by @value. If @n_parameters is 0 no parameters will be passed to the constructor.

func (*Value) FunctionCall

func (x *Value) FunctionCall(FirstParameterTypeVar types.GType, varArgs ...interface{}) *Value

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 <function>undefined</function> is returned

func (*Value) FunctionCallv

func (x *Value) FunctionCallv(NParametersVar uint, ParametersVar []Value) *Value

Call function referenced by @value, passing the given @parameters. If @n_parameters is 0 no parameters will be passed to the function.

This function always returns a #JSCValue, in case of void functions a #JSCValue referencing <function>undefined</function> is returned

func (*Value) GetContext

func (x *Value) GetContext() *Context

Get the #JSCContext in which @value was created.

func (*Value) GoPointer

func (c *Value) GoPointer() uintptr

func (*Value) IsArray

func (x *Value) IsArray() bool

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

func (*Value) IsArrayBuffer

func (x *Value) IsArrayBuffer() bool

Check whether the @value is an %ArrayBuffer.

func (*Value) IsBoolean

func (x *Value) IsBoolean() bool

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

func (*Value) IsConstructor

func (x *Value) IsConstructor() bool

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

func (*Value) IsFunction

func (x *Value) IsFunction() bool

Get whether the value referenced by @value is a function

func (*Value) IsNull

func (x *Value) IsNull() bool

Get whether the value referenced by @value is <function>null</function>.

func (*Value) IsNumber

func (x *Value) IsNumber() bool

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

func (*Value) IsObject

func (x *Value) IsObject() bool

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

func (*Value) IsString

func (x *Value) IsString() bool

Get whether the value referenced by @value is a string

func (*Value) IsTypedArray

func (x *Value) IsTypedArray() bool

Determines whether a value is a typed array.

func (*Value) IsUndefined

func (x *Value) IsUndefined() bool

Get whether the value referenced by @value is <function>undefined</function>.

func (*Value) NewTypedArrayWithBuffer

func (x *Value) NewTypedArrayWithBuffer(TypeVar TypedArrayType, OffsetVar uint, LengthVar int) *Value

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

Create a #JSCValue referencing a new typed array value containing elements of the given @type, where the elements are stored at the memory region represented by the @array_buffer.

The @type must *not* be %JSC_TYPED_ARRAY_NONE.

The @offset and @length parameters can be used to indicate which part of the array buffer can be accessed through the typed array. If both are omitted (passing zero as @offset, and `-1` as @length), the whole @array_buffer is exposed through the typed array. Omitting the @length with a non-zero @offset will expose the remainder of the @array_buffer starting at the indicated offset.

func (*Value) ObjectDefinePropertyAccessor

func (x *Value) ObjectDefinePropertyAccessor(PropertyNameVar string, FlagsVar ValuePropertyFlags, PropertyTypeVar types.GType, GetterVar *gobject.Callback, SetterVar *gobject.Callback, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify)

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 <function>Object.defineProperty()</function> when used with an accessor descriptor.

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.

func (*Value) ObjectDefinePropertyData

func (x *Value) ObjectDefinePropertyData(PropertyNameVar string, FlagsVar ValuePropertyFlags, PropertyValueVar *Value)

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.

func (*Value) ObjectDeleteProperty

func (x *Value) ObjectDeleteProperty(NameVar string) bool

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

func (*Value) ObjectEnumerateProperties

func (x *Value) ObjectEnumerateProperties() []string

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

func (*Value) ObjectGetProperty

func (x *Value) ObjectGetProperty(NameVar string) *Value

Get property with @name from @value.

func (*Value) ObjectGetPropertyAtIndex

func (x *Value) ObjectGetPropertyAtIndex(IndexVar uint) *Value

Get property at @index from @value.

func (*Value) ObjectHasProperty

func (x *Value) ObjectHasProperty(NameVar string) bool

Get whether @value has property with @name.

func (*Value) ObjectInvokeMethod

func (x *Value) ObjectInvokeMethod(NameVar string, FirstParameterTypeVar types.GType, varArgs ...interface{}) *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 <function>undefined</function> is returned.

func (*Value) ObjectInvokeMethodv

func (x *Value) ObjectInvokeMethodv(NameVar string, NParametersVar uint, ParametersVar []Value) *Value

Invoke method with @name on object referenced by @value, passing the given @parameters. If @n_parameters is 0 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 <function>undefined</function> is returned.

func (*Value) ObjectIsInstanceOf

func (x *Value) ObjectIsInstanceOf(NameVar string) bool

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

func (*Value) ObjectSetProperty

func (x *Value) ObjectSetProperty(NameVar string, PropertyVar *Value)

Set @property with @name on @value.

func (*Value) ObjectSetPropertyAtIndex

func (x *Value) ObjectSetPropertyAtIndex(IndexVar uint, PropertyVar *Value)

Set @property at @index on @value.

func (*Value) SetGoPointer

func (c *Value) SetGoPointer(ptr uintptr)

func (*Value) ToBoolean

func (x *Value) ToBoolean() bool

Convert @value to a boolean.

func (*Value) ToDouble

func (x *Value) ToDouble() float64

Convert @value to a double.

func (*Value) ToInt32

func (x *Value) ToInt32() int32

Convert @value to a #gint32.

func (*Value) ToJson

func (x *Value) ToJson(IndentVar uint) 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.

func (*Value) ToString

func (x *Value) ToString() string

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

func (*Value) ToStringAsBytes

func (x *Value) ToStringAsBytes() *glib.Bytes

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

func (*Value) TypedArrayGetBuffer

func (x *Value) TypedArrayGetBuffer() *Value

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

func (*Value) TypedArrayGetData

func (x *Value) TypedArrayGetData(LengthVar *uint) uintptr

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 contained in the typed array are also stored in the pointed location.

The returned pointer needs to be casted to the appropriate type (see #JSCTypedArrayType), and has the `offset` over the underlying array buffer data applied—that is, points to the first element of the typed array:

|[<!-- language="C" --> if (jsc_value_typed_array_get_type(value) != JSC_TYPED_ARRAY_UINT32)

g_error ("Only arrays of uint32_t are supported");

gsize count = 0; uint32_t *elements = jsc_value_typed_array_get_contents (value, &count); for (gsize i = 0; i < count; i++)

g_print ("index %zu, value %" PRIu32 "\n", i, elements[i]);

]|

Note that the pointer returned by this function is not guaranteed to remain the same after calls to other JSC API functions. See jsc_value_array_buffer_get_data() for details.

func (*Value) TypedArrayGetLength

func (x *Value) TypedArrayGetLength() uint

Gets the number of elements in a typed array.

func (*Value) TypedArrayGetOffset

func (x *Value) TypedArrayGetOffset() uint

Gets the offset over the underlying array buffer data.

func (*Value) TypedArrayGetSize

func (x *Value) TypedArrayGetSize() uint

Gets the size of a typed array.

func (*Value) TypedArrayGetType

func (x *Value) TypedArrayGetType() TypedArrayType

Gets the type of elements contained in a typed array.

type ValueClass

type ValueClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*ValueClass) GoPointer

func (x *ValueClass) GoPointer() uintptr

type ValuePropertyFlags

type ValuePropertyFlags int

Flags used when defining properties with jsc_value_object_define_property_data() and jsc_value_object_define_property_accessor().

const (

	// the type of the property descriptor may be changed and the
	//  property may be deleted from the corresponding object.
	JscValuePropertyConfigurableValue ValuePropertyFlags = 1
	// the property shows up during enumeration of the properties on
	//  the corresponding object.
	JscValuePropertyEnumerableValue ValuePropertyFlags = 2
	// the value associated with the property may be changed with an
	//  assignment operator. This doesn't have any effect when passed to jsc_value_object_define_property_accessor().
	JscValuePropertyWritableValue ValuePropertyFlags = 4
)

type VirtualMachine

type VirtualMachine struct {
	gobject.Object
}

JSCVirtualMachine represents a group of JSCContext<!-- -->s. It allows concurrent JavaScript execution by creating a different instance of JSCVirtualMachine in each thread.

To create a group of JSCContext<!-- -->s pass the same JSCVirtualMachine instance to every JSCContext constructor.

func NewVirtualMachine

func NewVirtualMachine() *VirtualMachine

Create a new #JSCVirtualMachine.

func VirtualMachineNewFromInternalPtr

func VirtualMachineNewFromInternalPtr(ptr uintptr) *VirtualMachine

func (*VirtualMachine) GoPointer

func (c *VirtualMachine) GoPointer() uintptr

func (*VirtualMachine) SetGoPointer

func (c *VirtualMachine) SetGoPointer(ptr uintptr)

type VirtualMachineClass

type VirtualMachineClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*VirtualMachineClass) GoPointer

func (x *VirtualMachineClass) GoPointer() uintptr

type WeakValue

type WeakValue struct {
	gobject.Object
}

JSCWeakValue represents a weak reference to a value in a #JSCContext. It can be used to keep a reference to a JavaScript value without protecting it from being garbage collected and without referencing the #JSCContext either.

func NewWeakValue

func NewWeakValue(ValueVar *Value) *WeakValue

Create a new #JSCWeakValue for the JavaScript value referenced by @value.

func WeakValueNewFromInternalPtr

func WeakValueNewFromInternalPtr(ptr uintptr) *WeakValue

func (*WeakValue) ConnectCleared

func (x *WeakValue) ConnectCleared(cb *func(WeakValue)) uint32

This signal is emitted when the JavaScript value is destroyed.

func (*WeakValue) GetValue

func (x *WeakValue) GetValue() *Value

Get a #JSCValue referencing the JavaScript value of @weak_value.

func (*WeakValue) GoPointer

func (c *WeakValue) GoPointer() uintptr

func (*WeakValue) SetGoPointer

func (c *WeakValue) SetGoPointer(ptr uintptr)

type WeakValueClass

type WeakValueClass struct {
	ParentClass gobject.ObjectClass
	// contains filtered or unexported fields
}

func (*WeakValueClass) GoPointer

func (x *WeakValueClass) GoPointer() uintptr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL