forked from JustMaier/angular-signalr-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
signalr-hub.min.js
1 lines (1 loc) · 1.08 KB
/
signalr-hub.min.js
1
angular.module("SignalR",[]).constant("$",$).factory("Hub",["$",function(a){function c(b){var c=null;return c=b&&b.rootPath?a.hubConnection(b.rootPath,{useDefaultPath:!1}):a.hubConnection(),c.logging=b&&b.logging?!0:!1,c}function d(a){var d=!(a&&a.useSharedConnection===!1);return d?"undefined"==typeof b[a.rootPath]?b[a.rootPath]=c(a):b[a.rootPath]:c(a)}var b=[];return function(b,c){var e=this;return e.connection=d(c),e.proxy=e.connection.createHubProxy(b),e.on=function(a,b){e.proxy.on(a,b)},e.invoke=function(){return e.proxy.invoke.apply(e.proxy,arguments)},e.disconnect=function(){e.connection.stop()},e.connect=function(){return e.connection.start(c.transport?{transport:c.transport}:null)},c&&c.listeners&&angular.forEach(c.listeners,function(a,b){e.on(b,a)}),c&&c.methods&&angular.forEach(c.methods,function(b){e[b]=function(){var c=a.makeArray(arguments);return c.unshift(b),e.invoke.apply(e,c)}}),c&&c.queryParams&&(e.connection.qs=c.queryParams),c&&c.errorHandler&&e.connection.error(c.errorHandler),c&&c.hubDisconnected&&e.connection.disconnected(c.hubDisconnected),e.promise=e.connect(),e}}]);