index.js
function (powder) {
		var callback = function (err) {
			shooting--;
			if (err) {
				// Only emit error if a listener exists
				// This is mainly to prevent silent errors in promises
				if (machinegun.listenerCount('error')) machinegun.emit('error', err);
				if (opt.giveUpOnError) machinegun.giveUp(err);
			}
			trigger();
		};
		var primer = function () {
			var maybeThenable = powder(callback);
			if (maybeThenable && (typeof maybeThenable.then == 'function')) {
				maybeThenable.then(callback.bind(null, null), function (err) { callback(err || new Error()); });
			}
		};
		this.shoot = function () {
			shooting++;
			process.nextTick(primer);
		};
	}
function (powder) {
		var callback = function (err) {
			shooting--;
			if (err) {
				// Only emit error if a listener exists
				// This is mainly to prevent silent errors in promises
				if (machinegun.listenerCount('error')) machinegun.emit('error', err);
				if (opt.giveUpOnError) machinegun.giveUp(err);
			}
			trigger();
		};
		var primer = function () {
			var maybeThenable = powder(callback);
			if (maybeThenable && (typeof maybeThenable.then == 'function')) {
				maybeThenable.then(callback.bind(null, null), function (err) { callback(err || new Error()); });
			}
		};
		this.shoot = function () {
			shooting++;
			process.nextTick(primer);
		};
	}
function ( powder ) { var callback = function ( err ) { shooting -- ; if ( err ) { // Only emit error if a listener exists
 // This is mainly to prevent silent errors in promises
 if ( machinegun . listenerCount ( 'error' ) ) machinegun . emit ( 'error' , err ) ; if ( opt . giveUpOnError ) machinegun . giveUp ( err ) ; } trigger ( ) ; } ; var primer = function ( ) { var maybeThenable = powder ( callback ) ; if ( maybeThenable && ( typeof maybeThenable . then == 'function' ) ) { maybeThenable . then ( callback . bind ( null , null ) , function ( err ) { callback ( err || new Error ( ) ) ; } ) ; } } ; this . shoot = function ( ) { shooting ++ ; process . nextTick ( primer ) ; } ; }
Primer function wrapper class Used mainly to contextualise callback
Primer function wrapper class Used mainly to contextualise callback