browser tabs example introduced.

This commit is contained in:
Miroslav Šedivý 2020-12-20 19:35:35 +01:00
parent 251cea24b8
commit 5755b45888

View File

@ -287,16 +287,14 @@
}
// TODO: Refactor.
public browserNavigateUrl(url: string) {
this.websocket.send('browser/navigate/url', { url })
public tabEvent(event: string, payload?: any | undefined) {
this.websocket.send('tabs/' + event, { payload })
}
public browserNavigateBack() {
this.websocket.send('browser/navigate/back')
}
public browserNavigateForward() {
this.websocket.send('browser/navigate/forward')
// TODO: Refactor.
tabHander?: (event: string, payload: any) => any
public tabSubscribe(func: (event: string, payload: any) => any) {
this.tabHander = func
}
/////////////////////////////
@ -325,6 +323,11 @@
} catch (e) {}
break
}
// TODO: Refactor.
if (event.match(/^tabs\//) && this.tabHander) {
this.tabHander(event, payload.payload)
}
})
this.websocket.on('connecting', () => {
Vue.set(this.state.connection, 'websocket', 'connecting')