Skip to content

Commit a36f59d

Browse files
authored
Merge tabRelay code with tab (#1249)
1 parent d2ea704 commit a36f59d

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

.changeset/nine-olives-taste.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"apollo-client-devtools": patch
3+
---
4+
5+
Merge the tabRelay script with the tab script by extracting the body of the Promise callback into tab.ts. This behavior was no longer needed.

src/extension/tab/tab.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
// This script is injected into each tab.
2-
import "./tabRelay";
32
import browser from "webextension-polyfill";
3+
import { ClientMessage } from "../messages";
4+
import { createPortActor, createWindowActor } from "../actor";
45

56
declare const __IS_FIREFOX__: boolean;
67

8+
const tab = createWindowActor<ClientMessage>(window);
9+
const devtools = createPortActor<ClientMessage>(
10+
browser.runtime.connect({ name: "tab" })
11+
);
12+
13+
devtools.forward("connectToClient", tab);
14+
devtools.forward("requestData", tab);
15+
devtools.forward("explorerSubscriptionTermination", tab);
16+
devtools.forward("explorerRequest", tab);
17+
18+
tab.forward("clientNotFound", devtools);
19+
tab.forward("connectToDevtools", devtools);
20+
tab.forward("disconnectFromDevtools", devtools);
21+
tab.forward("update", devtools);
22+
tab.forward("explorerResponse", devtools);
23+
724
// We run the hook.js script on the page as a content script in Manifest v3
825
// extensions (chrome for now). We do this using execution world MAIN.
926
//

src/extension/tab/tabRelay.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)