From c7fde94ac404a0308b6f3a4d5295db98901ed615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 24 Dec 2020 03:23:08 +0100 Subject: [PATCH] add headers manipulation. --- src/component/main.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/component/main.vue b/src/component/main.vue index ec23bb86..82a273e4 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -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')