lib/pool.js
/**
     * Add tasks array into pool.
     * @param tasks Task instances array.
     */
Add tasks array into pool.
@param tasks Task instances array.
Add tasks array into pool . @param tasks Task instances array .
addTasks(tasks) {
        let taskArr;
        if (tasks instanceof Array) {
            taskArr = tasks;
        }
        else if (tasks instanceof task_1.Task) {
            taskArr = [tasks];
        }
        else {
            throw new TypeError('Invalid task(s)');
        }
        const ids = [];
        taskArr.forEach((t) => {
            if (!(t instanceof task_1.Task)) {
                throw new TypeError('Invalid task');
            }
            const length = this.tasks.push(t);
            ids.push(length - 1);
        });
        return ids;
    }
addTasks ( tasks ) { let taskArr ; if ( tasks instanceof Array ) { taskArr = tasks ; } else if ( tasks instanceof task_1 . Task ) { taskArr = [ tasks ] ; } else { throw new TypeError ( 'Invalid task(s)' ) ; } const ids = [ ] ; taskArr . forEach ( ( t ) => { if ( ! ( t instanceof task_1 . Task ) ) { throw new TypeError ( 'Invalid task' ) ; } const length = this . tasks . push ( t ) ; ids . push ( length - 1 ) ; } ) ; return ids ; }
Add tasks array into pool.
Add tasks array into pool .