1.0.0 • Published 5 years ago

background-executor v1.0.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
5 years ago

background-executor

npm version

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 );
        });
    }
});
1.0.1

5 years ago

1.0.0

5 years ago