Context
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().
Skipped during bindings generation
parameter
exception
: exception: Out parameter is not supportedparameter
object
: object: Out parameter is not supportedparameter
destroy_notify
: GLib.DestroyNotifymethod
throw_printf
: Varargs parameter is not supportedmethod
throw_with_name_printf
: Varargs parameter is not supported
Constructors
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.
Create a new #JSCContext in @virtual_machine.
Properties
Functions
Clear the uncaught exception in @context if any.
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.
Get the last unhandled exception thrown in @context by API functions calls.
Get a #JSCValue referencing the @context global object
Remove the last #JSCExceptionHandler previously pushed to @context with jsc_context_push_exception_handler().
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.
Throw @exception to @context.
Throw an exception to @context using the given error name and message. The created #JSCException can be retrieved with jsc_context_get_exception().