Files
PhotonVision/chameleon-client/src/main.js

38 lines
936 B
JavaScript
Raw Normal View History

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify';
2019-03-24 21:01:25 +03:00
import VueNativeSock from 'vue-native-websocket';
import msgPack from 'msgpack5';
import axios from 'axios';
import VueAxios from "vue-axios";
2019-03-10 22:29:29 +02:00
2019-09-20 20:56:24 +03:00
Vue.config.productionTip = false;
if (process.env.NODE_ENV === "production"){
Vue.prototype.$address = location.host;
} else if (process.env.NODE_ENV === "development"){
Vue.prototype.$address = location.hostname + ":5800";
}
Vue.use(VueNativeSock, 'ws://' + Vue.prototype.$address + '/websocket');
Vue.use(VueAxios, axios);
Vue.prototype.$msgPack = msgPack(true);
Vue.mixin({
2019-10-29 23:58:06 +02:00
methods: {
handleInput(key, value) {
let msg = this.$msgPack.encode({[key]: value});
2019-10-29 23:58:06 +02:00
this.$socket.send(msg);
}
}
});
2019-03-10 22:29:29 +02:00
new Vue({
2019-10-29 23:58:06 +02:00
router,
store,
vuetify,
render: h => h(App)
}).$mount('#app');