Skip to content

Instantly share code, notes, and snippets.

@chaiwa-berian
Last active August 14, 2018 16:58
Show Gist options
  • Save chaiwa-berian/743d489eecb183710a420e70df977e22 to your computer and use it in GitHub Desktop.
Save chaiwa-berian/743d489eecb183710a420e70df977e22 to your computer and use it in GitHub Desktop.
//We are triggering start but we are catching done
var Job = require('./nodejs_inherit_events_main_job'); //inherit from main Job
var job = new Job();
job.on('done', function(details){ //Subscribe to the main job's done event
console.log('Job was completed at', details.completedOn);
job.removeAllListeners();
});
job.emit('start'); //Fire-up the main job
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment