1.0.0 • Published 5 years ago
background-executor v1.0.0
background-executor
NodeJS Background Executor Function
About
Execute asynchronous operations in sequence in the background
Example
When you code starts up:
'use strict';
const backgroundExecutor = require( 'background-executor' );
backgroundExecutor.start();
When you want to add an operation to the background execution queue:
'use strict';
const backgroundExecutor = require( 'background-executor' );
backgroundExecutor.addOperation({
operation: async () => {
await new Promise( resolve => {
setTimeout( () => {
console.log( 'operation in background log' );
resolve();
}, 1000 );
});
}
});