Expand description
Boa’s API to create and customize ECMAScript jobs and job queues.
Job is an ECMAScript Job, or a closure that runs an ECMAScript computation when
there’s no other computation running. The module defines several type of jobs:
PromiseJobfor Promise related jobs.TimeoutJobfor jobs that run after a certain amount of time.NativeAsyncJobfor jobs that supportFuture.NativeJobfor generic jobs that aren’t related to Promises.
JobCallback is an ECMAScript JobCallback record, containing an ECMAScript function
that is executed when a promise is either fulfilled or rejected.
JobExecutor is a trait encompassing the required functionality for a job executor; this allows
implementing custom event loops, custom handling of Jobs or other fun things.
This trait is also accompanied by two implementors of the trait:
IdleJobExecutor, which is an executor that does nothing, and the default executor if no executor is provided. Useful for hosts that want to disable promises.SimpleJobExecutor, which is a simple FIFO queue that runs all jobs to completion, bailing on the first error encountered. This simple executor will block on any async job queued.
§Trace?
Most of the types defined in this module don’t implement Trace. This is because most jobs can only
be run once, and putting a JobExecutor on a garbage collected object is not allowed.
In addition to that, not implementing Trace makes it so that the garbage collector can consider
any captured variables inside jobs as roots, since you cannot store jobs within a Gc.
Structs§
- Cancellation
Token - Token to cancel a
TimeoutJobandIntervalJob. - Generic
Job - An ECMAScript Generic Job.
- Idle
JobExecutor - A job executor that does nothing.
- Interval
Job - An ECMAScript Job that runs at a certain interval of time.
- JobCallback
JobCallbackrecords.- Native
Async Job - An ECMAScript Job that can be run asynchronously.
- Native
Job - An ECMAScript Job Abstract Closure.
- Native
JobFn - An ECMAScript Job Abstract Closure that can be called multiple times.
- Promise
Job - An ECMAScript Job Abstract Closure executing code related to
Promiseobjects. - Simple
JobExecutor - A simple FIFO executor that bails on the first error.
- Timeout
Job - An ECMAScript Job that runs after a certain amount of time.
Enums§
- Job
- A job that needs to be handled by a
JobExecutor.
Traits§
- JobExecutor
- An executor of
ECMAscriptJobs.
Type Aliases§
- Boxed
Future - The
Futurejob returned by aNativeAsyncJoboperation.