An ES6 library to add a network abstraction between calls to and fulfillment of function tasks.
See @debonet/tasks and @debonet/remote-promises.
Instead of being confined to a single application running on a single processor:
function someTaskFunction(){ return new Task( ... ) }
somePromiseFunction( args )
.progress( ... )
.then( ... )
.catch( ... )
.finally( ... );
With remote-task, we can move the handling of the function to a different process or machine.
In "forward mode":
Process 1:
function someTaskFunction(){ return new Task( ... ) }
RemoteTask.serve( someTaskFunction, 3000, { path: "somePath" } );
Process 2:
const someTaskFunction = RemoteTask.client( "ws://some_server:3000/somePath" );
someTaskFunction( args )
.progress( ... )
.then( ... )
.catch( ... )
.finally( ... );
and in "reverse mode":
On one or more processes:
function someTaskFunction(){ return new Task( ... ) }
RemoteTask.provide( someTaskFunction, "ws://some_server:3000/somePath" );
On another process:
const someTaskFunction = RemoteTask.marshal( 3000, { path: "somePath" } );
someTaskFunction( args )
.progress( ... )
.then( ... )
.catch( ... )
.finally( ... );
Identical to the API for @debonet/remote-promises, with the subsitution of Tasks for Promies.
npm install @debonet/remote-tasks