Skip to content

Commit bf6c306

Browse files
committed
v16.0.1
1 parent 8e311a4 commit bf6c306

File tree

3 files changed

+23
-33
lines changed

3 files changed

+23
-33
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"devDependencies": {
4646
"@babel/core": "^7.7.4",
4747
"@babel/preset-env": "^7.7.4",
48-
"socketcluster-server": "^16.0.0",
4948
"babel-plugin-minify-dead-code-elimination": "^0.5.0",
5049
"browserify": "^16.2.3",
5150
"es-check": "^5.1.0",
@@ -58,6 +57,7 @@
5857
"gulp-uglify": "^3.0.1",
5958
"localStorage": "^1.0.3",
6059
"mocha": "^5.2.0",
60+
"socketcluster-server": "^16.0.0",
6161
"uglify-es": "^3.3.9",
6262
"vinyl-source-stream": "^2.0.0"
6363
}

socketcluster-client.js

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* SocketCluster JavaScript client v15.1.0
2+
* SocketCluster JavaScript client v16.0.0
33
*/
44
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.socketClusterClient = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
55
(function (global){
@@ -4465,15 +4465,6 @@ class ConsumableStream {
44654465
throw new TypeError('Method must be overriden by subclass');
44664466
}
44674467

4468-
createConsumable(timeout) {
4469-
let asyncIterator = this.createConsumer(timeout);
4470-
return {
4471-
[Symbol.asyncIterator]: () => {
4472-
return asyncIterator;
4473-
}
4474-
}
4475-
}
4476-
44774468
[Symbol.asyncIterator]() {
44784469
return this.createConsumer();
44794470
}
@@ -6362,7 +6353,7 @@ class Consumer {
63626353
this.stream = stream;
63636354
this.currentNode = startNode;
63646355
this.timeout = timeout;
6365-
this._isIterating = false;
6356+
this.isAlive = true;
63666357
this.stream.setConsumer(this.id, this);
63676358
}
63686359

@@ -6377,7 +6368,7 @@ class Consumer {
63776368
return stats;
63786369
}
63796370

6380-
resetBackpressure() {
6371+
_resetBackpressure() {
63816372
this._backpressure = 0;
63826373
}
63836374

@@ -6410,19 +6401,21 @@ class Consumer {
64106401
clearTimeout(this._timeoutId);
64116402
delete this._timeoutId;
64126403
}
6413-
if (this._isIterating) {
6414-
this._killPacket = {value, done: true};
6415-
this.applyBackpressure(this._killPacket);
6416-
} else {
6417-
this.stream.removeConsumer(this.id);
6418-
this.resetBackpressure();
6419-
}
6404+
this._killPacket = {value, done: true};
6405+
this._destroy();
6406+
64206407
if (this._resolve) {
64216408
this._resolve();
64226409
delete this._resolve;
64236410
}
64246411
}
64256412

6413+
_destroy() {
6414+
this.isAlive = false;
6415+
this._resetBackpressure();
6416+
this.stream.removeConsumer(this.id);
6417+
}
6418+
64266419
async _waitForNextItem(timeout) {
64276420
return new Promise((resolve, reject) => {
64286421
this._resolve = resolve;
@@ -6445,23 +6438,19 @@ class Consumer {
64456438
}
64466439

64476440
async next() {
6448-
this._isIterating = true;
64496441
this.stream.setConsumer(this.id, this);
64506442

64516443
while (true) {
64526444
if (!this.currentNode.next) {
64536445
try {
64546446
await this._waitForNextItem(this.timeout);
64556447
} catch (error) {
6456-
this._isIterating = false;
6457-
this.stream.removeConsumer(this.id);
6448+
this._destroy();
64586449
throw error;
64596450
}
64606451
}
64616452
if (this._killPacket) {
6462-
this._isIterating = false;
6463-
this.stream.removeConsumer(this.id);
6464-
this.resetBackpressure();
6453+
this._destroy();
64656454
let killPacket = this._killPacket;
64666455
delete this._killPacket;
64676456

@@ -6476,8 +6465,7 @@ class Consumer {
64766465
}
64776466

64786467
if (this.currentNode.data.done) {
6479-
this._isIterating = false;
6480-
this.stream.removeConsumer(this.id);
6468+
this._destroy();
64816469
}
64826470

64836471
return this.currentNode.data;
@@ -6486,11 +6474,13 @@ class Consumer {
64866474

64876475
return() {
64886476
delete this.currentNode;
6489-
this._isIterating = false;
6490-
this.stream.removeConsumer(this.id);
6491-
this.resetBackpressure();
6477+
this._destroy();
64926478
return {};
64936479
}
6480+
6481+
[Symbol.asyncIterator]() {
6482+
return this;
6483+
}
64946484
}
64956485

64966486
function wait(timeout) {

socketcluster-client.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)