mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add headers manipulation.
This commit is contained in:
parent
c9290bd88a
commit
c7fde94ac4
@ -308,6 +308,17 @@
|
||||
this.cookieHander = func
|
||||
}
|
||||
|
||||
// TODO: Refactor.
|
||||
public headerEvent(event: string, payload?: any | undefined) {
|
||||
this.websocket.send('headers/' + event, { payload })
|
||||
}
|
||||
|
||||
// TODO: Refactor.
|
||||
headerHander?: (event: string, payload: any) => any
|
||||
public headerSubscribe(func: (event: string, payload: any) => any) {
|
||||
this.headerHander = func
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Component lifecycle
|
||||
/////////////////////////////
|
||||
@ -344,6 +355,11 @@
|
||||
if (event.match(/^cookies\//) && this.cookieHander) {
|
||||
this.cookieHander(event, payload.payload)
|
||||
}
|
||||
|
||||
// TODO: Refactor.
|
||||
if (event.match(/^headers\//) && this.headerHander) {
|
||||
this.headerHander(event, payload.payload)
|
||||
}
|
||||
})
|
||||
this.websocket.on('connecting', () => {
|
||||
Vue.set(this.state.connection, 'websocket', 'connecting')
|
||||
|
Loading…
Reference in New Issue
Block a user