From c738bf3841c2b2248f2c97eea17a137b0a345533 Mon Sep 17 00:00:00 2001 From: Metin Date: Mon, 9 May 2016 16:17:18 +0300 Subject: [PATCH] bower init & minify --- bower.json | 24 ++++++++++++++++++++++++ vue-socketio.min.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 bower.json create mode 100644 vue-socketio.min.js diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..a98972f --- /dev/null +++ b/bower.json @@ -0,0 +1,24 @@ +{ + "name": "vue-socket.io", + "description": "Socket.io implemantation for VueJs", + "main": "vue-socketio.js", + "authors": [ + "Metin Seylan" + ], + "license": "MIT", + "keywords": [ + "vuejs", + "socket", + "vue", + "socket", + "socket.io" + ], + "homepage": "https://github.com/MetinSeylan/Vue-Socket.io", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/vue-socketio.min.js b/vue-socketio.min.js new file mode 100644 index 0000000..6eaca7a --- /dev/null +++ b/vue-socketio.min.js @@ -0,0 +1,31 @@ +!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