@@ -27250,20 +27250,21 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
27250
27250
27251
27251
// listen to incoming notifications
27252
27252
if (this.provider && this.provider.on) {
27253
- this.provider.on('data', function requestManagerNotification(result) {
27254
- // err,
27255
- // if(!err) {
27256
- if (_this.subscriptions[result.params.subscription] && _this.subscriptions[result.params.subscription].callback) {
27253
+ this.provider.on('data', function requestManagerNotification(result, deprecatedResult) {
27254
+ result = result || deprecatedResult; // this is for possible old providers, which may had the error first handler
27255
+
27256
+ // check for result.method, to prevent old providers errors to pass as result
27257
+ if (result.method && _this.subscriptions[result.params.subscription] && _this.subscriptions[result.params.subscription].callback) {
27257
27258
_this.subscriptions[result.params.subscription].callback(null, result.params.result);
27258
27259
}
27259
- // } else {
27260
- //
27261
- // Object.keys(_this.subscriptions).forEach(function(id){
27262
- // if(_this.subscriptions[id].callback)
27263
- // _this.subscriptions[id].callback(err);
27264
- // });
27265
- // }
27266
27260
});
27261
+ // TODO add error, end, timeout, connect??
27262
+ // this.provider.on('error', function requestManagerNotification(result){
27263
+ // Object.keys(_this.subscriptions).forEach(function(id){
27264
+ // if(_this.subscriptions[id].callback)
27265
+ // _this.subscriptions[id].callback(err);
27266
+ // });
27267
+ // }
27267
27268
}
27268
27269
};
27269
27270
@@ -52543,7 +52544,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
52543
52544
// notification
52544
52545
if (!id && result.method.indexOf('_subscription') !== -1) {
52545
52546
_this.notificationCallbacks.forEach(function (callback) {
52546
- if (_.isFunction(callback)) callback(null, result);
52547
+ if (_.isFunction(callback)) callback(result);
52547
52548
});
52548
52549
52549
52550
// fire the callback
@@ -52579,11 +52580,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
52579
52580
52580
52581
this.connection.on('end', function () {
52581
52582
_this._timeout();
52582
-
52583
- // inform notifications
52584
- _this.notificationCallbacks.forEach(function (callback) {
52585
- if (_.isFunction(callback)) callback(new Error('IPC socket connection closed'));
52586
- });
52587
52583
});
52588
52584
52589
52585
this.connection.on('timeout', function () {
@@ -52704,6 +52700,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
52704
52700
this.notificationCallbacks.push(callback);
52705
52701
break;
52706
52702
52703
+ // adds error, end, timeout, connect
52707
52704
default:
52708
52705
this.connection.on(type, callback);
52709
52706
break;
@@ -52850,7 +52847,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
52850
52847
// notification
52851
52848
if (!id && result.method.indexOf('_subscription') !== -1) {
52852
52849
_this.notificationCallbacks.forEach(function (callback) {
52853
- if (_.isFunction(callback)) callback(null, result);
52850
+ if (_.isFunction(callback)) callback(result);
52854
52851
});
52855
52852
52856
52853
// fire the callback
@@ -52874,18 +52871,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
52874
52871
_this._timeout();
52875
52872
};
52876
52873
52877
- this.connection.onclose = function (e ) {
52874
+ this.connection.onclose = function () {
52878
52875
_this._timeout();
52879
52876
52880
- var noteCb = _this.notificationCallbacks;
52881
-
52882
52877
// reset all requests and callbacks
52883
52878
_this.reset();
52884
-
52885
- // cancel subscriptions
52886
- noteCb.forEach(function (callback) {
52887
- if (_.isFunction(callback)) callback(e);
52888
- });
52889
52879
};
52890
52880
52891
52881
// this.connection.on('timeout', function(){
0 commit comments