Start the engine.
Internally, configures the job processing functions, starts the load balancer and launches a first Web Worker.
A Promise for the current engine instance. Can be used for chaining multiple instance method calls.
The function which will process all jobs sent to this engine instance.
Optional
initFunction: WorkerInitFunction<unknown>A function for setting up a Web Worker environment before it starts processing jobs. May be sync or async.
Optional
initArgs: WorkerFunctionTransferArgsDynamic data to send to the initFunction to set up the environment of new Web Worker instances.
Schedule, execute and get the results of a job.
A Promise that will be fulfilled with T or an empty resolve when the job has been processed.
If the job threw an error when processing, the Promise will reject with an [`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Instance_properties) object containing the job's error message.
The return type of a successful job - meaning what the WorkerFunction
will return, with Transferable
objects inlined.
Rest
...args: WorkerFunctionTransferArgsStart as much WebWorkers as currently recommended by the browser, or allowed by afterburner.
You should use this only if you know you will have to process many jobs and want to ensure that the engine is fully revved up. In most cases the automatic "temperature" adjustement will provide a good balance between performance and memory footprint.
You should immediatly follow this call with your actual runJob calls, otherwise the engine might start to cool itself down automatically.
A Promise for the current engine instance. Can be used for chaining multiple instance method calls.
WARNING: Possibly unstable.
Overrides the maximum number of WebWorkers Rinzler will attempt to spawn.
Normally this is retrieved from navigator.hardwareConcurrency
, which is a browser-provided indicator of how many Workers a browsing context should use, with respect to the browser's own limitations and the number of available CPU cores on the host hardware.
By going beyond that number you may crash the browser tab, get unexpected errors, or a considerable boost in parallelized performance. Aim for the moon, right?
A Promise for the current engine instance. Can be used for chaining multiple instance method calls.
The new maximum number of WebWorkers this instance will manage. If set to lower than the current max, extra Workers will be gracefully shut down to respect the new limit.
Generated using TypeDoc
Welcome to Rinzler's full documentation.
If you're just getting started, check out the Quick Start guide.
This page describes the interface of an instanted RinzlerEngine class, which you can access like so: