You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -1285,10 +1390,10 @@ function ngViewFillContentFactory($compile, $controller, $route) {
1285
1390
1286
1391
})(window, window.angular);
1287
1392
1288
-
},{}],8:[function(require,module,exports){
1393
+
},{}],9:[function(require,module,exports){
1289
1394
!function(){"use strict";function t(t,e,o,u){function p(e,o,r){r||!c(o)||l(o)||(r=o,o=void 0),this.protocols=o,this.url=e||"Missing URL",this.ssl=/(wss)/i.test(this.url),this.scope=r&&r.scope||t,this.rootScopeFailover=r&&r.rootScopeFailover&&!0,this._reconnectAttempts=r&&r.reconnectAttempts||0,this.initialTimeout=r&&r.initialTimeout||500,this.maxTimeout=r&&r.maxTimeout||3e5,this.sendQueue=[],this.onOpenCallbacks=[],this.onMessageCallbacks=[],this.onErrorCallbacks=[],this.onCloseCallbacks=[],n(this._readyStateConstants),e?this._connect():this._setInternalState(0)}return p.prototype._readyStateConstants={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3,RECONNECT_ABORTED:4},p.prototype._reconnectableStatusCodes=[4e3],p.prototype.safeDigest=function(t){t&&!this.scope.$$phase&&this.scope.$digest()},p.prototype.bindToScope=function(e){return e&&(this.scope=e,this.rootScopeFailover&&this.scope.$on("$destroy",function(){this.scope=t})),this},p.prototype._connect=function(t){(t||!this.socket||this.socket.readyState!==this._readyStateConstants.OPEN)&&(this.socket=u.create(this.url,this.protocols),this.socket.onopen=this._onOpenHandler.bind(this),this.socket.onmessage=this._onMessageHandler.bind(this),this.socket.onerror=this._onErrorHandler.bind(this),this.socket.onclose=this._onCloseHandler.bind(this))},p.prototype.fireQueue=function(){for(;this.sendQueue.length&&this.socket.readyState===this._readyStateConstants.OPEN;){var t=this.sendQueue.shift();this.socket.send(s(t.message)?t.message:JSON.stringify(t.message)),t.deferred.resolve()}},p.prototype.notifyOpenCallbacks=function(){for(var t=0;t<this.onOpenCallbacks.length;t++)this.onOpenCallbacks[t].call(this)},p.prototype.notifyCloseCallbacks=function(t){for(var e=0;e<this.onCloseCallbacks.length;e++)this.onCloseCallbacks[e].call(this,t)},p.prototype.notifyErrorCallbacks=function(t){for(var e=0;e<this.onErrorCallbacks.length;e++)this.onErrorCallbacks[e].call(this,t)},p.prototype.onOpen=function(t){return this.onOpenCallbacks.push(t),this},p.prototype.onClose=function(t){return this.onCloseCallbacks.push(t),this},p.prototype.onError=function(t){return this.onErrorCallbacks.push(t),this},p.prototype.onMessage=function(t,e){if(!i(t))throw new Error("Callback must be a function");if(e&&a(e.filter)&&!s(e.filter)&&!(e.filter instanceof RegExp))throw new Error("Pattern must be a string or regular expression");return this.onMessageCallbacks.push({fn:t,pattern:e?e.filter:void 0,autoApply:e?e.autoApply:!0}),this},p.prototype._onOpenHandler=function(){this._reconnectAttempts=0,this.notifyOpenCallbacks(),this.fireQueue()},p.prototype._onCloseHandler=function(t){this.notifyCloseCallbacks(t),this._reconnectableStatusCodes.indexOf(t.code)>-1&&this.reconnect()},p.prototype._onErrorHandler=function(t){this.notifyErrorCallbacks(t)},p.prototype._onMessageHandler=function(t){for(var e,o,n=this,r=0;r<n.onMessageCallbacks.length;r++)o=n.onMessageCallbacks[r],e=o.pattern,e?s(e)&&t.data===e?(o.fn.call(n,t),n.safeDigest(o.autoApply)):e instanceof RegExp&&e.exec(t.data)&&(o.fn.call(n,t),n.safeDigest(o.autoApply)):(o.fn.call(n,t),n.safeDigest(o.autoApply))},p.prototype.close=function(t){return(t||!this.socket.bufferedAmount)&&this.socket.close(),this},p.prototype.send=function(t){function o(t){t.cancel=n;var e=t.then;return t.then=function(){var t=e.apply(this,arguments);return o(t)},t}function n(e){return s.sendQueue.splice(s.sendQueue.indexOf(t),1),r.reject(e),s}var r=e.defer(),s=this,i=o(r.promise);return s.readyState===s._readyStateConstants.RECONNECT_ABORTED?r.reject("Socket connection has been closed"):(s.sendQueue.push({message:t,deferred:r}),s.fireQueue()),i},p.prototype.reconnect=function(){var t=this;return t.close(),o(t._connect,t._getBackoffDelay(++t._reconnectAttempts)),t},p.prototype._getBackoffDelay=function(t){var e=Math.random()+1,o=this.initialTimeout,n=2,r=t,s=this.maxTimeout;return Math.floor(Math.min(e*o*Math.pow(n,r),s))},p.prototype._setInternalState=function(t){if(Math.floor(t)!==t||0>t||t>4)throw new Error("state must be an integer between 0 and 4, got: "+t);r||(this.readyState=t||this.socket.readyState),this._internalConnectionState=t,angular.forEach(this.sendQueue,function(t){t.deferred.reject("Message cancelled due to closed socket connection")})},r&&r(p.prototype,"readyState",{get:function(){return this._internalConnectionState||this.socket.readyState},set:function(){throw new Error("The readyState property is read-only")}}),function(t,e){return new p(t,e)}}function e(t,e){this.create=function(e,o){var n,r,s=/wss?:\/\//.exec(e);if(!s)throw new Error("Invalid url provided");if("object"==typeof exports&&require)try{r=require("ws"),n=r.Client||r.client||r}catch(i){}return n=n||t.WebSocket||t.MozWebSocket,o?new n(e,o):new n(e)},this.createWebSocketBackend=function(t,o){return e.warn("Deprecated: Please use .create(url, protocols)"),this.create(t,o)}}var o=angular.noop,n=Object.freeze?Object.freeze:o,r=Object.defineProperty,s=angular.isString,i=angular.isFunction,a=angular.isDefined,c=angular.isObject,l=angular.isArray,u=Array.prototype.slice;Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,o=Number(arguments[1])||0;for(o=0>o?Math.ceil(o):Math.floor(o),0>o&&(o+=e);e>o;o++)if(o in this&&this[o]===t)return o;return-1}),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=u.call(arguments,1),o=this,n=function(){},r=function(){return o.apply(this instanceof n&&t?this:t,e.concat(u.call(arguments)))};return n.prototype=this.prototype,r.prototype=new n,r}),angular.module("ngWebSocket",[]).factory("$websocket",["$rootScope","$q","$timeout","$websocketBackend",t]).factory("WebSocket",["$rootScope","$q","$timeout","WebsocketBackend",t]).service("$websocketBackend",["$window","$log",e]).service("WebSocketBackend",["$window","$log",e]),angular.module("angular-websocket",["ngWebSocket"])}();
0 commit comments