aboutsummaryrefslogtreecommitdiff
path: root/src/popup/popup.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/popup/popup.ts')
-rw-r--r--src/popup/popup.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/popup/popup.ts b/src/popup/popup.ts
new file mode 100644
index 0000000..78866e9
--- /dev/null
+++ b/src/popup/popup.ts
@@ -0,0 +1,18 @@
+type Payload = {
+ prompt: string;
+ context: any;
+};
+
+const promptEl: HTMLTextAreaElement = document.getElementById("prompt") as HTMLTextAreaElement;
+const sendBtn: HTMLButtonElement = document.getElementById("send") as HTMLButtonElement;
+const outputEl: HTMLElement = document.getElementById("output") as HTMLElement;
+
+sendBtn.addEventListener("click", async (): Promise<void> => {
+ const ctx: any = await browser.runtime.sendMessage({ type: "getComposeContext" });
+ const payload: Payload = {
+ prompt: promptEl.value,
+ context: ctx,
+ };
+ outputEl.textContent = JSON.stringify(payload, null, 2);
+ alert(JSON.stringify(payload, null, 2));
+});