mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
browser tabs example introduced.
This commit is contained in:
parent
251cea24b8
commit
5755b45888
@ -287,16 +287,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Refactor.
|
// TODO: Refactor.
|
||||||
public browserNavigateUrl(url: string) {
|
public tabEvent(event: string, payload?: any | undefined) {
|
||||||
this.websocket.send('browser/navigate/url', { url })
|
this.websocket.send('tabs/' + event, { payload })
|
||||||
}
|
}
|
||||||
|
|
||||||
public browserNavigateBack() {
|
// TODO: Refactor.
|
||||||
this.websocket.send('browser/navigate/back')
|
tabHander?: (event: string, payload: any) => any
|
||||||
}
|
public tabSubscribe(func: (event: string, payload: any) => any) {
|
||||||
|
this.tabHander = func
|
||||||
public browserNavigateForward() {
|
|
||||||
this.websocket.send('browser/navigate/forward')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@ -325,6 +323,11 @@
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Refactor.
|
||||||
|
if (event.match(/^tabs\//) && this.tabHander) {
|
||||||
|
this.tabHander(event, payload.payload)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.websocket.on('connecting', () => {
|
this.websocket.on('connecting', () => {
|
||||||
Vue.set(this.state.connection, 'websocket', 'connecting')
|
Vue.set(this.state.connection, 'websocket', 'connecting')
|
||||||
|
Loading…
Reference in New Issue
Block a user