mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-03 00:39:56 +02:00
add headers manipulation.
This commit is contained in:
parent
c9290bd88a
commit
c7fde94ac4
1 changed files with 16 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue