code: function (emits, message, daemonPid) {
      var monitor = new Monitor(message, options, daemonPid, shutdown, child, function () {
  
        // emit events before starting child
        Object.keys(emits).forEach(function (name) {
          // skip the process event until the child spawns
          if (name === 'process') return;
  
          monitor.emit.apply(monitor, [name].concat( emits[name] ));
        });
  
        // spawn child when monitor is ready
        child.spawn();
  
        // start pumping streams to monitor
        child.pump(monitor);
      });
  
      // once the child has started emit the process event
      child.once('start', function () {
        monitor.pid.process = child.pid;
        monitor.emit.apply(monitor, ['process'].concat( emits.process ));
      });
  
      // relay stop and restart to process event on monitor
      child.on('stop', function () {
        monitor.pid.process = null;
  
        // Do not emit if the deamon is in restart mode
        if (daemonInRestart) return;
        monitor.emit('process', 'stop');
      });
      child.on('restart', function () {
        monitor.pid.process = child.pid;
        monitor.emit('process', 'restart');
      });
    }
docs: first create monitor object, the callback is executed when the monitor constructor call this.ready