crunchbutton/www/assets/cockpit/js/socket.min.js
2014-11-18 21:06:22 -08:00

7 lines
1.2 KiB
JavaScript
Executable File

/*
* @license
* angular-socket-io v0.6.1
* (c) 2014 Brian Ford http://briantford.com
* License: MIT
*/
angular.module("btford.socket-io",[]).provider("socketFactory",function(){"use strict";var n="socket:";this.$get=["$rootScope","$timeout",function(t,e){var r=function(n,t){return t?function(){var r=arguments;e(function(){t.apply(n,r)},0)}:angular.noop};return function(e){e=e||{};var o=e.ioSocket||io.connect(),u=void 0===e.prefix?n:e.prefix,i=e.scope||t,c=function(n,t){o.on(n,t.__ng=r(o,t))},a=function(n,t){o.once(n,t.__ng=r(o,t))},s={on:c,addListener:c,once:a,emit:function(n,t,e){var u=arguments.length-1,e=arguments[u];return"function"==typeof e&&(e=r(o,e),arguments[u]=e),o.emit.apply(o,arguments)},removeListener:function(n,t){return t&&t.__ng&&(arguments[1]=t.__ng),o.removeListener.apply(o,arguments)},removeAllListeners:function(){return o.removeAllListeners.apply(o,arguments)},disconnect:function(n){return o.disconnect(n)},forward:function(n,t){n instanceof Array==!1&&(n=[n]),t||(t=i),n.forEach(function(n){var e=u+n,i=r(o,function(){Array.prototype.unshift.call(arguments,e),t.$broadcast.apply(t,arguments)});t.$on("$destroy",function(){o.removeListener(n,i)}),o.on(n,i)})}};return s}}]});