lib/SlaveChildProcess.js
/**
   * Adds a task listener for this slave.
   * @param {String} name The name of the task.
   * @param {Function} listener The listener to attach.
   * @return {SlaveChildProcess} The current slave child process.
   */
Adds a task listener for this slave.
@param {String} name The name of the task.
@param {Function} listener The listener to attach.
@return {SlaveChildProcess} The current slave child process.
Adds a task listener for this slave . @param { String } name The name of the task . @param { Function } listener The listener to attach . @return { SlaveChildProcess } The current slave child process .
task(name, listener) {
    if (typeof name === 'number') name = name.toString();
    if (typeof name === 'string' && listener instanceof Function) {
      if (!this[slave].tasks[name]) {
        this[slave].tasks[name] = listener;
      } else {
        throw new TypeError(`Slave already has a listener for task ${name}`);
      }
    } else {
      throw new TypeError('Slave#task: Invalid arguments. Name should be a string, and listener a function.');
    }
    return this;
  }
task ( name , listener ) { if ( typeof name === 'number' ) name = name . toString ( ) ; if ( typeof name === 'string' && listener instanceof Function ) { if ( ! this [ slave ] . tasks [ name ] ) { this [ slave ] . tasks [ name ] = listener ; } else { throw new TypeError ( ` ${ name } ` ) ; } } else { throw new TypeError ( 'Slave#task: Invalid arguments. Name should be a string, and listener a function.' ) ; } return this ; }
Adds a task listener for this slave.
Adds a task listener for this slave .