Initial webpage and backend
This commit is contained in:
36
toid_frontend/src/main.ts
Normal file
36
toid_frontend/src/main.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import { ros } from './ros_client'
|
||||
|
||||
import '@/assets/scss/global.scss'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
|
||||
ros.connect('http://localhost:3000')
|
||||
|
||||
ros.on('error', (error) => {
|
||||
console.log(error)
|
||||
setTimeout(() => {
|
||||
ros.connect('http://localhost:3000').catch()
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
ros.on('close', () => {
|
||||
setTimeout(() => {
|
||||
if (!ros.isConnected) {
|
||||
ros.connect('http://localhost:3000').catch()
|
||||
}
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
ros.on('connection', () => {
|
||||
console.log('Connection made!')
|
||||
})
|
||||
Reference in New Issue
Block a user