Skip to content

Commit

Permalink
Merge 4df1918 into f869bd6
Browse files Browse the repository at this point in the history
  • Loading branch information
gvuyk committed Apr 19, 2019
2 parents f869bd6 + 4df1918 commit 5e03867
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -165,6 +165,8 @@ upcoming([option] [, cb]) => {Promise}

### Event types

#### Event: 'ready' - Emitted when the module is ready to process events.

#### Event: 'event' - Emitted when an event is received.
The handler will be called with the following argument:

Expand Down
1 change: 1 addition & 0 deletions lib/dtimer.js
Expand Up @@ -81,6 +81,7 @@ function DTimer(id, pub, sub, option) {
return;
}
debug(self._id+': lua loading successful');
self.emit('ready');
});
this._maxEvents = this._option.maxEvents;

Expand Down
8 changes: 8 additions & 0 deletions test/ApiTests.js
Expand Up @@ -104,6 +104,14 @@ describe('ApiTests', function () {
});
});

it('emits ready after redis is setup successfully', function (done) {
var pub = redis.createClient();
var dt = new DTimer('me', pub, null);
dt.on('ready', function () {
done();
});
});

it('Detect malformed message on subscribe', function (done) {
sandbox.stub(require('lured'), 'create', function () {
return {
Expand Down

0 comments on commit 5e03867

Please sign in to comment.