Skip to content

Commit

Permalink
Add some Docco.
Browse files Browse the repository at this point in the history
  • Loading branch information
flatheadmill committed Jul 24, 2016
1 parent 5d00d68 commit 74150ac
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions program.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@ var interrupt = require('interrupt').createInterrupter('bigeasy.arguable')
var events = require('events')
var Command = require('./command')

// The program is an event emitter that proxies events from the Node.js
// `Process` object with a single special event of its own.


// The `newListner` function is used to hook the `"newListener"` event of the
// `Program` object. It will set a proxy event on the parent Node.js `Process`
// or Arguable `Program`.

//
function newListener (eventName) {
switch (eventName) {
// The `"shutdown"` event is a convenience event that responds to both
// `SIGINT` and `SIGTERM`.
case 'shutdown':
if (this._shutdown.count == 0) {
this._process.on('SIGINT', this._shutdown.listener)
this._process.on('SIGTERM', this._shutdown.listener)
}
this._shutdown.count++
break
// Default is to proxy the event on the parent `Process` or `Program`.
default:
this._getListenerProxy(eventName).count++
break
Expand Down Expand Up @@ -46,6 +58,8 @@ function removeListener (eventName) {
// This will never be pretty. Let it be ugly. Let it swallow all the sins before
// they enter your program, so that your program can be a garden of pure
// ideology.

//
function Program (usage, env, argv, io, module) {
this._usage = usage

Expand Down

0 comments on commit 74150ac

Please sign in to comment.