message handler for chatbot
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lukas Bachschwell 2020-01-02 18:12:16 +01:00
parent 37bb19d384
commit 8e7029f5fd
Signed by: lbsadmin
GPG Key ID: CCC6AA87CC8DF425

View File

@ -12,6 +12,8 @@ export default {
return {} return {}
}, },
mounted: () => { mounted: () => {
window.addEventListener('message', this.messageEventHandler, false)
let host = 'https://joinbot.tk/bot' let host = 'https://joinbot.tk/bot'
let stylesheetdir = '/bot/assets/modules/channel-web/chat.css' let stylesheetdir = '/bot/assets/modules/channel-web/chat.css'
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
@ -34,10 +36,15 @@ export default {
}, 1500) }, 1500)
}, },
beforeDestroy: () => { beforeDestroy: () => {
window.removeEventListener('message', this.messageEventHandler, false)
document.getElementById('bp-widget').parentElement.removeChild(document.getElementById('bp-widget')) document.getElementById('bp-widget').parentElement.removeChild(document.getElementById('bp-widget'))
}, },
methods: { methods: {
messageEventHandler(event) {
console.log('Message handler')
console.log(event.message)
}
} }
} }
</script> </script>