From 414257b49c425b9b6be3877e483644c2360749d5 Mon Sep 17 00:00:00 2001 From: diegodelrieue Date: Mon, 22 Apr 2024 15:53:23 +0200 Subject: [PATCH] fix: enable adapters in subscriptions --- src/adapter/chrome.ts | 5 ++++- src/adapter/window.ts | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/adapter/chrome.ts b/src/adapter/chrome.ts index d7b0104..ebfe409 100644 --- a/src/adapter/chrome.ts +++ b/src/adapter/chrome.ts @@ -105,7 +105,10 @@ export const createChromeHandler = ( } const subscription = result.subscribe({ - next: (data) => sendResponse({ result: { type: 'data', data } }), + next: (data) => { + const serializedData = transformer.output.serialize(data); + sendResponse({ result: { type: 'data', data: serializedData } }); + }, error: handleError, complete: () => sendResponse({ result: { type: 'stopped' } }), }); diff --git a/src/adapter/window.ts b/src/adapter/window.ts index 1e63f8f..7d7c2c3 100644 --- a/src/adapter/window.ts +++ b/src/adapter/window.ts @@ -111,7 +111,11 @@ export const createWindowHandler = ( } const subscription = result.subscribe({ - next: (data) => sendResponse({ result: { type: 'data', data } }), + next: (data) => { + const serializedData = transformer.output.serialize(data); + + sendResponse({ result: { type: 'data', data: serializedData } }); + }, error: handleError, complete: () => sendResponse({ result: { type: 'stopped' } }), });