|
185 | 185 | };
|
186 | 186 |
|
187 | 187 | $WebSocket.prototype._onCloseHandler = function _onCloseHandler(event) {
|
188 | | - this.notifyCloseCallbacks(event); |
| 188 | + var self = this; |
| 189 | + if (self.useApplyAsync) { |
| 190 | + self.scope.$applyAsync(function() { |
| 191 | + self.notifyCloseCallbacks(event); |
| 192 | + }); |
| 193 | + } else { |
| 194 | + self.notifyCloseCallbacks(event); |
| 195 | + self.safeDigest(autoApply); |
| 196 | + } |
189 | 197 | if ((this.reconnectIfNotNormalClose && event.code !== this._normalCloseCode) || this._reconnectableStatusCodes.indexOf(event.code) > -1) {
|
190 | 198 | this.reconnect();
|
191 | 199 | }
|
192 | 200 | };
|
193 | 201 |
|
194 | 202 | $WebSocket.prototype._onErrorHandler = function _onErrorHandler(event) {
|
195 | | - this.notifyErrorCallbacks(event); |
| 203 | + var self = this; |
| 204 | + if (self.useApplyAsync) { |
| 205 | + self.scope.$applyAsync(function() { |
| 206 | + self.notifyErrorCallbacks(event); |
| 207 | + }); |
| 208 | + } else { |
| 209 | + self.notifyErrorCallbacks(event); |
| 210 | + self.safeDigest(autoApply); |
| 211 | + } |
196 | 212 | };
|
197 | 213 |
|
198 | 214 | $WebSocket.prototype._onMessageHandler = function _onMessageHandler(message) {
|
|
0 commit comments