Skip to content

Commit

Permalink
Emit 'disconnected' when disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
lllte committed Oct 3, 2014
1 parent a1c9280 commit fa2b40c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/schema.js
Expand Up @@ -124,6 +124,7 @@ function Schema(name, settings) {

// we have an adaper now?
if (!this.adapter) {
this.emit('disconnected');
throw new Error('Adapter "' + name + '" is not defined correctly: it should define `adapter` member of schema synchronously');
}

Expand Down Expand Up @@ -499,6 +500,7 @@ Schema.prototype.disconnect = function disconnect(cb) {
if (typeof this.adapter.disconnect === 'function') {
this.connected = false;
this.adapter.disconnect(cb);
this.emit('disconnected');
} else if (cb) {
cb();
}
Expand Down

0 comments on commit fa2b40c

Please sign in to comment.