Comparing version 0.4.1 to 0.4.2
@@ -178,4 +178,10 @@ 'use strict'; | ||
var document = this.documents[id]; | ||
if (document) return document; | ||
// If there's already a document open, return it. But make sure it wasn't in | ||
// the process of closing, otherwise its future messages will be dropped. | ||
if (document) { | ||
document.closing = false; | ||
return document; | ||
} | ||
var types = this.types; | ||
@@ -182,0 +188,0 @@ |
@@ -84,2 +84,3 @@ 'use strict'; | ||
_this.inflight = null; | ||
_this.closing = false; | ||
_this.closed = false; | ||
@@ -107,11 +108,22 @@ _this.subscribed = false; | ||
_context.next = 3; | ||
return this.settle(); | ||
this.closing = true; | ||
this.emit('closing'); | ||
case 3: | ||
_context.next = 5; | ||
return this.unsubscribe(); | ||
return this.settle(); | ||
case 5: | ||
_context.next = 7; | ||
return this.unsubscribe(); | ||
case 7: | ||
if (this.closing) { | ||
_context.next = 9; | ||
break; | ||
} | ||
return _context.abrupt('return'); | ||
case 9: | ||
this.client.removeListener('disconnect', this.onClientDisconnect); | ||
@@ -121,3 +133,3 @@ this.closed = true; | ||
case 8: | ||
case 12: | ||
case 'end': | ||
@@ -124,0 +136,0 @@ return _context.stop(); |
{ | ||
"name": "nexus", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
117784
3080