It derives from <GObject>.
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
context:evaluate or context:evaluate-with-source-uri. It’s also
possible to register custom objects in the context with
jsc_context_register_class().
The <JSCVirtualMachine> in which the
context was created.
Its value is a <JSCVirtualMachine>, or
#f.
It can only be set when the object is made, with
#:virtual-machine.
Check the given code in self 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
#f to exception to ignore the error details.
Passed: a <JSCContext>.
Passed: a string.
a JavaScript script to check
Passed: a 64-bit integer.
length of code, or -1 if code is a nul-terminated string
Passed: a <%JSCCheckSyntaxMode>, or one of
its symbols.
Passed: a string.
the source URI
Passed: an unsigned 32-bit integer.
the starting line number
Returned: a <%JSCCheckSyntaxResult>.
Returned: a <JSCException>.
return location for a <JSCException>, or
#f to ignore
Clear the uncaught exception in self if any.
Passed: a <JSCContext>.
Evaluate code in self.
Passed: a <JSCContext>.
Passed: a string.
a JavaScript script to evaluate
Passed: a 64-bit integer.
length of code, or -1 if code is a nul-terminated string
Returned: a <JSCValue>.
a <JSCValue> representing the last value generated
by the script.
Evaluate code and create an new object where symbols defined in
code will be added as properties, instead of being added to
self global object. The new object is returned as object
parameter. Similar to how value:new-object works, if object-instance is not
#f 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.
Passed: a <JSCContext>.
Passed: a string.
a JavaScript script to evaluate
Passed: a 64-bit integer.
length of code, or -1 if code is a nul-terminated string
Passed: a foreign pointer, or a bytevector, or #f.
an object instance
Passed: a <JSCClass>, or #f.
a <JSCClass> or #f to use the default
Passed: a string.
the source URI
Passed: an unsigned 32-bit integer.
the starting line number
Returned: a <JSCValue>.
a <JSCValue> representing the last value generated
by the script.
Returned: a <JSCValue>.
return location for a <JSCValue>.
Evaluate code in self 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.
Passed: a <JSCContext>.
Passed: a string.
a JavaScript script to evaluate
Passed: a 64-bit integer.
length of code, or -1 if code is a nul-terminated string
Passed: a string.
the source URI
Passed: an unsigned 32-bit integer.
the starting line number
Returned: a <JSCValue>.
a <JSCValue> representing the last value generated
by the script.
Get the <JSCContext> that is currently executing a
function. This should only be called within a function or method
callback, otherwise #f will be returned.
Returned: a <JSCContext>, or #f.
the <JSCContext> that is currently executing.
Get the last unhandled exception thrown in self by API functions calls.
Passed: a <JSCContext>.
Returned: a <JSCException>, or #f.
a <JSCException> or #f if there isn’t any
unhandled exception in the <JSCContext>.
Get a <JSCValue> referencing the self global
object
Passed: a <JSCContext>.
Returned: a <JSCValue>.
Get a property of self global object with name.
Passed: a <JSCContext>.
Passed: a string.
the value name
Returned: a <JSCValue>.
Get the <JSCVirtualMachine> where
self was created.
Passed: a <JSCContext>.
Returned: a <JSCVirtualMachine>.
the <JSCVirtualMachine> where the
<JSCContext> was created.
Create a new <JSCContext>. The context is created
in a new <JSCVirtualMachine>. Use
context:new-with-virtual-machine to create a
new <JSCContext> in an existing
<JSCVirtualMachine>.
Returned: a <JSCContext>.
the newly created <JSCContext>.
Create a new <JSCContext> in
virtual-machine.
Passed: a <JSCVirtualMachine>.
Returned: a <JSCContext>.
the newly created <JSCContext>.
Remove the last JSCExceptionHandler
previously pushed to self with context:push-exception-handler.
Passed: a <JSCContext>.
Push an exception handler in self. Whenever a JavaScript
exception happens in the <JSCContext>, the given
handler will be called. The default
JSCExceptionHandler simply calls
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
context:throw-exception in
handler like the default one does. The last exception handler
pushed is the only one used by the <JSCContext>,
use context:pop-exception-handler to remove it and
set the previous one. When handler is removed from the context,
destroy-notify is called with user-data as parameter.
Passed: a <JSCContext>.
Passed: a procedure.
See JSCExceptionHandler for how it is
called.
Not passed: guile-gi supplies it.
user data to pass to handler
Not passed: guile-gi supplies it.
destroy notifier for user-data
See GDestroyNotify for how it is
called.
Set a property of self global object with name and value.
Passed: a <JSCContext>.
Passed: a string.
the value name
Passed: a <JSCValue>.
Throw an exception to self using the given error message. The
created <JSCException> can be retrieved with
context:get-exception.
Passed: a <JSCContext>.
Passed: a string.
an error message
Throw exception to self.
Passed: a <JSCContext>.
Passed: a <JSCException>.
Throw an exception to self using the given error name and message.
The created <JSCException> can be retrieved with
context:get-exception.
Passed: a <JSCContext>.
Passed: a string.
the error name
Passed: a string.
an error message