eventloop

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventLoop

type EventLoop struct {
	// contains filtered or unexported fields
}

EventLoop ...

func NewEventLoop

func NewEventLoop(vm *goja.Runtime) *EventLoop

NewEventLoop ...

func (*EventLoop) Run

func (loop *EventLoop) Run(fn func(*goja.Runtime))

Run calls the specified function, starts the event loop and waits until there are no more delayed jobs to run after which it stops the loop and returns. The instance of goja.Runtime that is passed to the function and any Values derived from it must not be used outside of the function. Do NOT use this function while the loop is already running. Use RunOnLoop() instead.

func (*EventLoop) RunOnLoop

func (loop *EventLoop) RunOnLoop(fn func(*goja.Runtime))

RunOnLoop schedules to run the specified function in the context of the loop as soon as possible. The order of the runs is preserved (i.e. the functions will be called in the same order as calls to RunOnLoop()) The instance of goja.Runtime that is passed to the function and any Values derived from it must not be used outside of the function.

func (*EventLoop) Start

func (loop *EventLoop) Start()

Start the event loop in the background. The loop continues to run until Stop() is called.

func (*EventLoop) Stop

func (loop *EventLoop) Stop()

Stop the loop that was started with Start(). After this function returns there will be no more jobs executed by the loop. It is possible to call Start() or Run() again after this to resume the execution. Note, it does not cancel active timeouts.

Jump to

Keyboard shortcuts

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