bower init & minify
parent
dbc09e970d
commit
c738bf3841
@ -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"
|
||||||
|
]
|
||||||
|
}
|
@ -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)
|
||||||
|
}();
|
Loading…
Reference in New Issue