Documentation
¶
Overview ¶
Package bridge provides the small set of runtime services shared by host modules. It deliberately does not depend on the parent jsruntime package.
Index ¶
- Variables
- func ExitCodeFromError(err error) (int64, bool)
- func ExitCodeFromValue(value goja.Value) (int64, bool)
- func RunWithDeadline(vm *goja.Runtime, deadline time.Time, fn func() error) error
- type ErrorReporter
- type ExitRequestedError
- type Runtime
- func (r *Runtime) AddResource(close func()) uint64
- func (r *Runtime) CloseResources()
- func (r *Runtime) Loop() *eventloop.EventLoop
- func (r *Runtime) RemoveResource(id uint64)
- func (r *Runtime) ResourcesOpen() bool
- func (r *Runtime) RunJob(vm *goja.Runtime, name string, job func() error) error
- func (r *Runtime) RunOnLoop(job func(*goja.Runtime)) bool
- func (r *Runtime) RunTurn(vm *goja.Runtime, job func() error) error
- func (r *Runtime) SetErrorReporter(report ErrorReporter)
- func (r *Runtime) SetTurnRunner(run TurnRunner)
- func (r *Runtime) Timeout() time.Duration
- type TurnRunner
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrExecutionTimeout = errors.New("JavaScript execution timeout")
Functions ¶
func ExitCodeFromError ¶
ExitCodeFromError returns the exit code when err was thrown by process.exit.
func ExitCodeFromValue ¶
ExitCodeFromValue returns the exit code when a rejected Promise carries the process.exit error object.
Types ¶
type ExitRequestedError ¶
type ExitRequestedError struct {
Code int64
}
ExitRequestedError stops a script turn with the requested process exit code. Code 0 is treated as a normal termination; nonzero codes are surfaced as failures.
func (*ExitRequestedError) Error ¶
func (e *ExitRequestedError) Error() string
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is the host-facing service boundary used by JavaScript modules.
func (*Runtime) AddResource ¶
func (*Runtime) CloseResources ¶
func (r *Runtime) CloseResources()
func (*Runtime) RemoveResource ¶
func (*Runtime) ResourcesOpen ¶
func (*Runtime) RunJob ¶
RunJob executes one asynchronous host callback as a bounded JavaScript turn.
func (*Runtime) SetErrorReporter ¶
func (r *Runtime) SetErrorReporter(report ErrorReporter)
func (*Runtime) SetTurnRunner ¶
func (r *Runtime) SetTurnRunner(run TurnRunner)
Click to show internal directories.
Click to hide internal directories.