Context
Object Hierarchy:
Description:
[
CCode ( type_id =
"jsc_context_get_type ()" ) ]
public sealed class Context :
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 evaluate or
evaluate_with_source_uri. It's also possible to register custom
objects in the context with register_class.
Content:
Properties:
Static methods:
Creation methods:
Methods:
- public void @throw (string error_message)
Throw an exception to this using the
given error message.
- public CheckSyntaxResult check_syntax (string code, ssize_t length, CheckSyntaxMode mode, string uri, uint line_number, out Exception exception)
Check the given code in this
for syntax errors.
- public void clear_exception ()
Clear the uncaught exception in this
if any.
- public Value evaluate (string code, ssize_t length)
Evaluate code in this.
- public Value evaluate_in_object (string code, ssize_t length, void* object_instance, Class? object_class, string uri, uint line_number, out Value object)
Evaluate code and create an new object where symbols
defined in code will be added as properties, instead of being added to this global
object.
- public Value evaluate_with_source_uri (string code, ssize_t length, string uri, uint line_number)
Evaluate code in this
using uri as the source URI.
- public unowned Exception? get_exception ()
Get the last unhandled exception thrown in
this by API functions calls.
- public Value get_global_object ()
Get a Value referencing the
this global object
- public Value get_value (string name)
Get a property of this global object
with name.
- public unowned VirtualMachine get_virtual_machine ()
- public void pop_exception_handler ()
- public void push_exception_handler (owned ExceptionHandler handler)
Push an exception handler in this.
- public unowned Class register_class (string name, Class? parent_class, ClassVTable? vtable, DestroyNotify? destroy_notify)
Register a custom class in this
using the given name.
- public void set_value (string name, Value value)
Set a property of this global object
with name and value.
- public void throw_exception (Exception exception)
Throw exception to this
.
- public void throw_with_name (string error_name, string error_message)
Throw an exception to this using the
given error name and message.
Inherited Members:
All known members inherited from class GLib.Object