Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for direct responses #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Use implicit callback()
callback() is triggered automatically if no error is passed when the node event loop is empty. No need for any fancy handling.
roborourke authored Mar 29, 2017

Unverified

This user has not yet uploaded their public signing key.
commit ccd1744d7c4f5694e59b5d08b7491ad35dc4a772
5 changes: 0 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ class Slack extends EventEmitter {
* @param {Object} response A response object or string
*/
callback(callback, response) {
delete this.callback;
callback(null, JSON.stringify(response));
}

@@ -136,10 +135,6 @@ class Slack extends EventEmitter {

// trigger all events
events.forEach(name => this.emit(name, payload, bot, this.store));

// Send success signal if callback not used in handler
if ( this.callback )
this.callback();
}

}