diff --git a/vue-socketio.min.js b/vue-socketio.min.js index 6eaca7a..c7ddd3d 100644 --- a/vue-socketio.min.js +++ b/vue-socketio.min.js @@ -1,31 +1 @@ -!function () { - var o = "function" == typeof require ? require("socket.io-client") : window.io; - if (!o)throw new Error("[Vue-Socket.io] cannot locate Socket.io"); - var n = { - install: function (n, t) { - if (!t)throw new Error("[Vue-Socket.io] cannot locate connection"); - if ("string" == typeof t)var e = o(t); else if ("object" == typeof t)var e = t; - var c = e.onevent; - e.onevent = function (o) { - var n = o.data || []; - c.call(this, o), o.data = ["*"].concat(n), c.call(this, o) - }; - var i = ["connect", "error", "disconnect", "reconnect", "reconnect_attempt", "reconnecting", "reconnect_error", "reconnect_failed"]; - n.mixin({ - created: function () { - var o = this; - this.$options.hasOwnProperty("sockets") && (e.on("*", function (n, t) { - o.$options.sockets.hasOwnProperty(n) && o.$options.sockets[n].call(o, t) - }), i.forEach(function (n) { - e.on(n, function (t) { - o.$options.sockets.hasOwnProperty(n) && o.$options.sockets[n].call(o, t) - }) - })), this.$socket = e - } - }) - } - }; - "object" == typeof exports ? module.exports = n : "function" == typeof define && define.amd ? define([], function () { - return n - }) : window.Vue && (window.VueSocketio = n) -}(); \ No newline at end of file +!function(){var o="function"==typeof require?require("socket.io-client"):window.io;if(!o)throw new Error("[Vue-Socket.io] cannot locate Socket.io");var n={install:function(n,t){if(!t)throw new Error("[Vue-Socket.io] cannot locate connection");if("string"==typeof t)var e=o(t);else if("object"==typeof t)var e=t;var c=e.onevent;e.onevent=function(o){var n=o.data||[];c.call(this,o),o.data=["*"].concat(n),c.call(this,o)};var i=["connect","error","disconnect","reconnect","reconnect_attempt","reconnecting","reconnect_error","reconnect_failed"];n.mixin({created:function(){var o=this;this.$options.hasOwnProperty("sockets")&&(e.on("*",function(n,t){o.$options.sockets.hasOwnProperty(n)&&o.$options.sockets[n].call(o,t)}),i.forEach(function(n){e.on(n,function(t){o.$options.sockets.hasOwnProperty(n)&&o.$options.sockets[n].call(o,t)})})),this.$socket=e}})}};"object"==typeof exports?module.exports=n:"function"==typeof define&&define.amd?define([],function(){return n}):window.Vue&&(window.VueSocketio=n)}(); \ No newline at end of file