added prop to panel

This commit is contained in:
Ben Arc
2021-04-20 14:57:59 +01:00
parent 459e7cb523
commit 7d85310f30

View File

@@ -101,7 +101,8 @@
return { return {
fullscreen_cam: true, fullscreen_cam: true,
textareaModel: '', textareaModel: '',
iframe: '' iframe: '',
copilot: {}
} }
}, },
methods: { methods: {
@@ -130,36 +131,37 @@
} }
}, },
created: function () { created: function () {
var copilot = JSON.parse(localStorage.getItem('copilot')) self = this
console.log(copilot.id) self.copilot = JSON.parse(localStorage.getItem('copilot'))
console.log(this.copilot.id)
if (location.protocol == 'https:') { if (location.protocol == 'https:') {
console.log(location.protocol) console.log(location.protocol)
this.connection = new WebSocket( self.connection = new WebSocket(
'wss://' + 'wss://' +
document.domain + document.domain +
':' + ':' +
location.port + location.port +
'/copilot/ws/panel/' + '/copilot/ws/panel/' +
copilot.id self.copilot.id
) )
} else { } else {
this.connection = new WebSocket( self.connection = new WebSocket(
'ws://' + 'ws://' +
document.domain + document.domain +
':' + ':' +
location.port + location.port +
'/copilot/ws/panel/' + '/copilot/ws/panel/' +
copilot.id self.copilot.id
) )
} }
this.connection.addEventListener('open', function (event) {}) self.connection.addEventListener('open', function (event) {})
this.connection.addEventListener('message', function (event) { self.connection.addEventListener('message', function (event) {
console.log('Message from server ', event.data) console.log('Message from server ', event.data)
}) })
this.connection.addEventListener('close', function (event) { self.connection.addEventListener('close', function (event) {
console.log('The connection has been closed') console.log('The connection has been closed')
}) })
} }