Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
futoin-asyncsteps
Advanced tools
Readme
Stability: 3 - Stable
FutoIn AsyncSteps mimics traditional threads of execution in single threaded event loop. It supports all features including cancellation, exit handlers, thread local storage and synchronization primitives.
Additionally, it supports async/Promise integration as step through as.await()
API.
Documentation --> FutoIn Guide
Reference implementation of:
FTN12: FutoIn Async API
Version: 1.13
Spec: FTN12: FutoIn Async API v1.x
Author: Andrey Galkin
Command line:
$ npm install futoin-asyncsteps --save
or
$ yarn add futoin-asyncsteps
Hint: checkout FutoIn CID for all tools setup.
Pre-built ES5 CJS modules are available under es5/
. These modules
can be used with webpack
without transpiler - default "browser" entry point
points to ES5 version.
Webpack dists are also available under dist/
folder, but their usage should be limited
to sites without build process. There are "full", "lite" and "development" version builds.
Warning: older browsers should use dist/polyfill-asyncsteps.js
for WeakMap
polyfill used in synchronization primitives.
The following globals are available:
const $as = require('futoin-asyncsteps');
const root_as = $as();
root_as.add( ( as ) => {
as.success( "MyValue" );
// as.success() is implicit, if not called
} ).add(
( as, arg ) => {
if ( arg === 'MyValue' ) {
as.add( ( as ) => {
as.error( 'MyError', 'Something bad has happened' );
});
}
},
( as, err ) => {
if ( err === 'MyError' ) {
as.success( 'NotSoBad' );
// as.add() acts as implicit as.success()
}
}
);
root_as.add( ( as, arg ) => {
if ( arg === 'NotSoBad' ) {
console.log( 'MyError was ignored: ' + as.state.error_info );
}
as.state.p1arg = 'abc';
as.state.p2arg = 'xyz';
const p = as.parallel();
p.add( ( as ) => {
console.log( 'Parallel Step 1' );
as.add( ( as ) => {
console.log( 'Parallel Step 1.1' );
as.state.p1 = as.state.p1arg + '1';
} );
} );
p.add( ( as ) =>{
console.log( 'Parallel Step 2' );
as.add( ( as ) => {
console.log( 'Parallel Step 2.1' );
as.state.p2 = as.state.p2arg + '2';
} );
} );
} ).add( ( as ) => {
console.log( 'Parallel 1 result: ' + as.state.p1 );
console.log( 'Parallel 2 result: ' + as.state.p2 );
} );
root_as.execute();
Result:
MyError was ignored: Something bad has happened
Parallel Step 1
Parallel Step 2
Parallel Step 1.1
Parallel Step 2.1
Parallel 1 result: abc1
Parallel 2 result: xyz2
var async_steps = require('futoin-asyncsteps');
function dummy_service_read( success, error ){
// We expect it calles success when data is available
// and error, if error occurs
// Returns some request handle
}
function dummy_service_cancel( reqhandle ){
// We assume it cancels previously scheduled reqhandle
}
var root_as = async_steps();
root_as.add( function( as ){
setImmediate( function(){
as.success( 'async success()' );
} );
as.setTimeout( 10 ); // ms
} ).add(
function( as, arg ){
console.log( arg );
var reqhandle = dummy_service_read(
function( data ){
as.success( data );
},
function( err ){
if ( err !== 'SomeSpecificCancelCode' )
{
as.error( err );
}
}
);
as.setCancel(function(as){
dummy_service_cancel( reqhandle );
});
// OPTIONAL. Set timeout of 1s
as.setTimeout( 1000 );
},
function( as, err )
{
console.log( err + ": " + as.state.error_info );
}
);
root_as.execute();
Result:
async success()
Timeout:
var async_steps = require('futoin-asyncsteps');
var model_as = async_steps();
model_as.state.var = 'Vanilla';
model_as.add( function(as){
console.log('-----');
console.log( 'Hi! I am from model_as' );
console.log( 'State.var: ' + as.state.var );
as.state.var = 'Dirty';
});
for ( var i = 0; i < 3; ++i )
{
var root_as = async_steps();
root_as.copyFrom( model_as );
root_as.add( function(as){
as.add(function( as ){
console.log('>> The first inner step');
});
as.copyFrom( model_as );
});
root_as.execute();
}
Result. Please note the order as only the first step is executed in the loop. The rest is executed quasi-parallel by nature of async programming. The model_as closure gets executed 6 times, but created only once.
-----
Hi! I am from model_as
State.var: Vanilla
-----
Hi! I am from model_as
State.var: Vanilla
-----
Hi! I am from model_as
State.var: Vanilla
>> The first inner step
>> The first inner step
>> The first inner step
-----
Hi! I am from model_as
State.var: Dirty
-----
Hi! I am from model_as
State.var: Dirty
-----
Hi! I am from model_as
State.var: Dirty
var async_steps = require('futoin-asyncsteps');
var root_as = async_steps();
root_as.add(
function( as ){
as.repeat( 3, function( as, i ) {
console.log( "> Repeat: " + i );
} );
as.forEach( [ 1, 2, 3 ], function( as, k, v ) {
console.log( "> forEach: " + k + " = " + v );
} );
as.forEach( { a: 1, b: 2, c: 3 }, function( as, k, v ) {
console.log( "> forEach: " + k + " = " + v );
} );
}
);
root_as.execute();
Result:
> Repeat: 0
> Repeat: 1
> Repeat: 2
> forEach: 0 = 1
> forEach: 1 = 2
> forEach: 2 = 3
> forEach: a = 1
> forEach: b = 2
> forEach: c = 3
<script src="../dist/futoin-asyncsteps.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
$as()
.add(function(as){
console.log( 'Step1' );
})
.add(function(as){
console.log( 'Step2' );
})
.execute();
</script>
Result:
Step1
Step2
'use strict';
const $as = require('futoin-asyncsteps');
// Note: Mutex requires ES6 and is not provided as member of $as
const Mutex = require( 'futoin-asyncsteps/Mutex' );
const mtx = new Mutex();
let curr_concurrency = 0;
for ( let i = 0; i < 3; ++i )
{
$as()
.sync(mtx, (as) => {
// regular AsyncSteps in critical section
++curr_concurrency;
as.add((as) => {
as.success(curr_concurrency--);
});
})
.add((as, val) => {
console.log(`Max concurrency ${i}: ${val}`);
})
.execute();
}
// Max concurrency 0: 1
// Max concurrency 1: 1
// Max concurrency 2: 1
const thrtl = new Throttle(10, 100);
const as = $as();
const p = as.parallel();
let passed = 0;
for ( let i = 0; i < 100; ++i ) {
p.add((as) => {
as.sync(thrtl, (as) => { passed += 1 });
});
}
as.execute();
setTimeout(() => {
expect(passed).to.equal(50);
}, 450);
// NOTE: it's not exposed through main entry point
$as_test = require( 'futoin-asyncsteps/testcase' );
// Positive test example
it( 'should ...', $as_test(
( as ) => {
// some test logic
}
) );
// Negative test example
it( 'should ...', $as_test(
( as ) => {
// some test logic
// Forced as.error('NegativeTestMustThrow') step in the end
},
( as, err ) => {
if ( err === 'ExpectedError' ) {
as.success();
}
}
) );
// Access "this" provided by Mocha
it( 'should ...', $as_test(
function( as ) {
// note use a full function instead of a light arrow function
this.timeout( 1e3 );
}
) );
async
/await
/Promise
integrationconst func = async () => {
// AsyncSteps can be used as Promise
await $as().add( (as) => {} ).promise();
};
// AsyncSteps can await Promise
$as.await(func);
Base interface for synchronization primitives
Limiter - complex processing limit for AsyncSteps
Mutual exclusion mechanism for AsyncSteps
Throttling for AsyncSteps
Neutral interface to event scheduler
Special event scheduler for testing to be installed with installAsyncToolTest()
window.$as - browser-only reference to futoin-asyncsteps module
window.FutoIn.$as - browser-only reference to futoin-asyncsteps module
window.FutoInError - browser-only reference to futoin-asyncsteps.FutoInError
window.futoin.AsyncSteps - browser-only reference to futoin-asyncsteps.AsyncSteps
window.$as - browser-only reference to futoin-asyncsteps module
window.FutoIn.$as - browser-only reference to futoin-asyncsteps module
window.FutoInError - browser-only reference to futoin-asyncsteps.FutoInError
window.futoin.AsyncSteps - browser-only reference to futoin-asyncsteps.AsyncSteps
object
List of standard FutoIn Core errors. It may static get extended in runtime.
function
Mocha-compatible test case based on AsyncSteps.
Example:
it('should ...', $as_test( (as) => {}, (as, err) => {} );
Use for unit testing to fine control step execution. It installs AsyncToolTest in place of AsyncTool
Ensure parameter is instance of AsyncSteps interfaces
Base interface for synchronization primitives
Limiter - complex processing limit for AsyncSteps
C-tor
Param | Type | Default | Description |
---|---|---|---|
[options] | object | {} | option map |
[options.concurrent] | integer | 1 | maximum concurrent flows |
[options.max_queue] | integer | 0 | maximum queued |
[options.rate] | integer | 1 | maximum entries in period |
[options.period_ms] | integer | 1000 | period length |
[options.burst] | integer | 0 | maximum queue for rate limiting |
Mutual exclusion mechanism for AsyncSteps
C-tor
Param | Type | Default | Description |
---|---|---|---|
[max] | integer | 1 | maximum number of simultaneous critical section entries |
[max_queue] | integer |
| limit queue length, if set |
Throttling for AsyncSteps
C-tor
Param | Type | Default | Description |
---|---|---|---|
[max] | integer | 1 | maximum number of simultaneous critical section entries |
[period_ms] | intger | 1000 | time period in milliseconds |
[max_queue] | integer |
| limit queue length, if set |
Neutral interface to event scheduler
Kind: global variable
Object
Wrapper for setTimeout()
Kind: static method of AsyncTool
Returns: Object
- - timer handle
Param | Type | Default | Description |
---|---|---|---|
func | function | callback to execute | |
[timeout_ms] | number | 0 | optional timeout in ms |
Wrapper for clearTimeout()/clearImmediate()
Kind: static method of AsyncTool
Param | Type | Description |
---|---|---|
handle | Object | Handle returned from AsyncTool.callLater |
Object
Wrapper for setImmediate()
Kind: static method of AsyncTool
Returns: Object
- - timer handle
Param | Type | Description |
---|---|---|
func | function | callback to execute |
Wrapper for clearImmediate()
Kind: static method of AsyncTool
Param | Type | Description |
---|---|---|
handle | Object | Handle returned from AsyncTool.callImmediate |
Special event scheduler for testing to be installed with installAsyncToolTest()
Kind: global variable
Object
boolean
array
Object
Adds callback to internal queue
Kind: static method of AsyncToolTest
Returns: Object
- timer handle
Param | Type | Default | Description |
---|---|---|---|
func | function | callback to execute | |
[timeout_ms] | number | 0 | optional timeout in ms |
Removed callback from internal queue
Kind: static method of AsyncToolTest
Param | Type | Description |
---|---|---|
handle | Object | Handle returned from AsyncToolTest.callLater |
Process next even in the internal queue
Kind: static method of AsyncToolTest
boolean
Check if there are any events scheduled
Kind: static method of AsyncToolTest
Returns: boolean
- true, if pending events
array
Get internal even queue
Kind: static method of AsyncToolTest
Returns: array
- event queue
Clear internal event queue
Kind: static method of AsyncToolTest
Execute all remaining events in the internal queue
Kind: static method of AsyncToolTest
window.$as - browser-only reference to futoin-asyncsteps module
window.FutoIn.$as - browser-only reference to futoin-asyncsteps module
window.FutoInError - browser-only reference to futoin-asyncsteps.FutoInError
window.futoin.AsyncSteps - browser-only reference to futoin-asyncsteps.AsyncSteps
Kind: global variable
object
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
Promise
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
object
Get AsyncSteps state object.
Note: There is a JS-specific improvement: as.state === as.state()
The are the following pre-defined state variables:
Kind: instance property of AsyncSteps
AsyncSteps
Add sub-step. Can be called multiple times.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
func | ExecFunc | function defining non-blocking step execution |
[onerror] | ErrorFunc | Optional, provide error handler |
AsyncSteps
Creates a step internally and returns specialized AsyncSteps interfaces all steps of which are executed in quasi-parallel.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- interface for parallel step adding
Param | Type | Description |
---|---|---|
[onerror] | ErrorFunc | Optional, provide error handler |
AsyncSteps
Add sub-step with synchronization against supplied object.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
object | ISync | Mutex, Throttle or other type of synchronization implementation. |
func | ExecFunc | function defining non-blocking step execution |
[onerror] | ErrorFunc | Optional, provide error handler |
Set error and throw to abort execution.
NOTE: If called outside of AsyncSteps stack (e.g. by external event), make sure you catch the exception
Kind: instance method of AsyncSteps
Throws:
Error
Param | Type | Description |
---|---|---|
name | string | error message, expected to be identifier "InternalError" |
[error_info] | string | optional descriptive message assigned to as.state.error_info |
AsyncSteps
Copy steps and not yet defined state variables from "model" AsyncSteps instance
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
other | AsyncSteps | model instance, which must get be executed |
AsyncSteps
Use only on root AsyncSteps instance. Abort execution of AsyncSteps instance in progress.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
AsyncSteps
Start execution of AsyncSteps using AsyncTool
It must not be called more than once until cancel/complete (instance can be re-used)
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
AsyncSteps
Execute loop until as.break() or as.error() is called
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
func | LoopFunc | loop body |
[label] | string | optional label to use for as.break() and as.continue() in inner loops |
AsyncSteps
Call func(as, i) for count times
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
count | integer | how many times to call the func |
func | RepeatFunc | loop body |
[label] | string | optional label to use for as.break() and as.continue() in inner loops |
AsyncSteps
For each map or list element call func( as, key, value )
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
map_or_list | integer | map or list to iterate over |
func | ForEachFunc | loop body |
[label] | string | optional label to use for as.break() and as.continue() in inner loops |
AsyncSteps
Shortcut for this.add( ( as ) => as.success( ...args ) )
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
[args...] | any | argument to pass, if any |
AsyncSteps
Integrate a promise as a step.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
promise | Promise | promise to add as a step |
[onerror] | function | error handler to check |
Promise
Execute AsyncSteps with Promise interface
Kind: instance method of AsyncSteps
Returns: Promise
- - promise wrapper for AsyncSteps
AsyncSteps
Create a new instance of AsyncSteps for independent execution
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- new instance
Successfully complete current step execution, optionally passing result variables to the next step.
Kind: instance method of AsyncSteps
Param | Type | Description |
---|---|---|
[..._arg] | * | unlimited number of result variables with no type constraint |
AsyncSteps
Set timeout for external event completion with async as.success() or as.error() call. If step is not finished until timeout is reached then Timeout error is raised.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Note: Can be used only within ExecFunc body.
Param | Type | Description |
---|---|---|
timeout_ms | number | Timeout in ms |
AsyncSteps
Set cancellation handler to properly handle timeouts and external cancellation.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Note: Can be used only within ExecFunc body.
Param | Type | Description |
---|---|---|
oncancel | CancelFunc | cleanup/cancel logic of external processing |
AsyncSteps
Mark currently executing step as waiting for external event.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Note: Can be used only within ExecFunc body.
Break execution of current loop, throws exception
Kind: instance method of AsyncSteps
Param | Type | Description |
---|---|---|
[label] | string | Optional. unwind loops, until label named loop is exited |
Continue loop execution from the next iteration, throws exception
Kind: instance method of AsyncSteps
Param | Type | Description |
---|---|---|
[label] | string | Optional. unwind loops, until label named loop is found |
window.$as - browser-only reference to futoin-asyncsteps module
window.FutoIn.$as - browser-only reference to futoin-asyncsteps module
window.FutoInError - browser-only reference to futoin-asyncsteps.FutoInError
window.futoin.AsyncSteps - browser-only reference to futoin-asyncsteps.AsyncSteps
Kind: global variable
object
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
Promise
AsyncSteps
AsyncSteps
AsyncSteps
AsyncSteps
object
Get AsyncSteps state object.
Note: There is a JS-specific improvement: as.state === as.state()
The are the following pre-defined state variables:
Kind: instance property of AsyncSteps
AsyncSteps
Add sub-step. Can be called multiple times.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
func | ExecFunc | function defining non-blocking step execution |
[onerror] | ErrorFunc | Optional, provide error handler |
AsyncSteps
Creates a step internally and returns specialized AsyncSteps interfaces all steps of which are executed in quasi-parallel.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- interface for parallel step adding
Param | Type | Description |
---|---|---|
[onerror] | ErrorFunc | Optional, provide error handler |
AsyncSteps
Add sub-step with synchronization against supplied object.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
object | ISync | Mutex, Throttle or other type of synchronization implementation. |
func | ExecFunc | function defining non-blocking step execution |
[onerror] | ErrorFunc | Optional, provide error handler |
Set error and throw to abort execution.
NOTE: If called outside of AsyncSteps stack (e.g. by external event), make sure you catch the exception
Kind: instance method of AsyncSteps
Throws:
Error
Param | Type | Description |
---|---|---|
name | string | error message, expected to be identifier "InternalError" |
[error_info] | string | optional descriptive message assigned to as.state.error_info |
AsyncSteps
Copy steps and not yet defined state variables from "model" AsyncSteps instance
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
other | AsyncSteps | model instance, which must get be executed |
AsyncSteps
Use only on root AsyncSteps instance. Abort execution of AsyncSteps instance in progress.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
AsyncSteps
Start execution of AsyncSteps using AsyncTool
It must not be called more than once until cancel/complete (instance can be re-used)
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
AsyncSteps
Execute loop until as.break() or as.error() is called
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
func | LoopFunc | loop body |
[label] | string | optional label to use for as.break() and as.continue() in inner loops |
AsyncSteps
Call func(as, i) for count times
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
count | integer | how many times to call the func |
func | RepeatFunc | loop body |
[label] | string | optional label to use for as.break() and as.continue() in inner loops |
AsyncSteps
For each map or list element call func( as, key, value )
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
map_or_list | integer | map or list to iterate over |
func | ForEachFunc | loop body |
[label] | string | optional label to use for as.break() and as.continue() in inner loops |
AsyncSteps
Shortcut for this.add( ( as ) => as.success( ...args ) )
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
[args...] | any | argument to pass, if any |
AsyncSteps
Integrate a promise as a step.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Param | Type | Description |
---|---|---|
promise | Promise | promise to add as a step |
[onerror] | function | error handler to check |
Promise
Execute AsyncSteps with Promise interface
Kind: instance method of AsyncSteps
Returns: Promise
- - promise wrapper for AsyncSteps
AsyncSteps
Create a new instance of AsyncSteps for independent execution
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- new instance
Successfully complete current step execution, optionally passing result variables to the next step.
Kind: instance method of AsyncSteps
Param | Type | Description |
---|---|---|
[..._arg] | * | unlimited number of result variables with no type constraint |
AsyncSteps
Set timeout for external event completion with async as.success() or as.error() call. If step is not finished until timeout is reached then Timeout error is raised.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Note: Can be used only within ExecFunc body.
Param | Type | Description |
---|---|---|
timeout_ms | number | Timeout in ms |
AsyncSteps
Set cancellation handler to properly handle timeouts and external cancellation.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Note: Can be used only within ExecFunc body.
Param | Type | Description |
---|---|---|
oncancel | CancelFunc | cleanup/cancel logic of external processing |
AsyncSteps
Mark currently executing step as waiting for external event.
Kind: instance method of AsyncSteps
Returns: AsyncSteps
- self
Note: Can be used only within ExecFunc body.
Break execution of current loop, throws exception
Kind: instance method of AsyncSteps
Param | Type | Description |
---|---|---|
[label] | string | Optional. unwind loops, until label named loop is exited |
Continue loop execution from the next iteration, throws exception
Kind: instance method of AsyncSteps
Param | Type | Description |
---|---|---|
[label] | string | Optional. unwind loops, until label named loop is found |
object
List of standard FutoIn Core errors. It may static get extended in runtime.
Kind: global namespace
object
string
string
string
string
string
string
string
string
string
string
string
string
string
string
Connection error before request is sent.
Kind: static constant of FutoInErrors
Note: Must be generated on Invoker side
string
Communication error at any stage after request is sent and before response is received.
Kind: static constant of FutoInErrors
Note: Must be generated on Invoker side
string
Unknown interface requested.
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
Not supported interface version.
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
In case interface function is not implemented on Executor side
Kind: static constant of FutoInErrors
Note: Must be generated on Executor side
string
Security policy on Executor side does not allow to access interface or specific function.
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
Unexpected internal error on Executor side, including internal CommError.
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
Unexpected internal error on Invoker side, not related to CommError.
Kind: static constant of FutoInErrors
Note: Must be generated only on Invoker side
string
Invalid data is passed as FutoIn request.
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
Defense system has triggered rejection
Kind: static constant of FutoInErrors
Note: Must be generated on Executor side, but also possible to be triggered on Invoker
string
Executor requests re-authorization
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
'sec' request section has invalid data or not SecureChannel
Kind: static constant of FutoInErrors
Note: Must be generated only on Executor side
string
Timeout occurred in any stage
Kind: static constant of FutoInErrors
Note: Must be used only internally and should never travel in request message
function
Mocha-compatible test case based on AsyncSteps.
Example:
it('should ...', $as_test( (as) => {}, (as, err) => {} );
Kind: global function
Returns: function
- suitable for it()
Mocha call
Param | Type | Description |
---|---|---|
func | ExecFunc | function defining non-blocking step execution |
[onerror] | ErrorFunc | Optional, provide error handler |
Use for unit testing to fine control step execution. It installs AsyncToolTest in place of AsyncTool
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
[install] | boolean | true | true - install AsyncToolTest, false - AsyncTool as scheduler |
Ensure parameter is instance of AsyncSteps interfaces
Kind: global function
Param | Type | Description |
---|---|---|
as | any | paramter to check |
FAQs
Mimic traditional threads in single threaded event loop
The npm package futoin-asyncsteps receives a total of 54 weekly downloads. As such, futoin-asyncsteps popularity was classified as not popular.
We found that futoin-asyncsteps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.