From 296ccb68298e7f1de591a16adce59b99cc40152a Mon Sep 17 00:00:00 2001 From: Hinton Date: Mon, 5 Oct 2020 15:44:19 +0200 Subject: [PATCH] WIP desktop communication --- src/background.ts | 10 ++++++++++ src/manifest.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/background.ts b/src/background.ts index 301fe1a289..ef62efffaa 100644 --- a/src/background.ts +++ b/src/background.ts @@ -4,3 +4,13 @@ const bitwardenMain = (window as any).bitwardenMain = new MainBackground(); bitwardenMain.bootstrap().then(() => { // Finished bootstrapping }); + +const port = chrome.runtime.connectNative('com.8bit.bitwarden'); + +port.onMessage.addListener((msg: any) => { + console.log('Received' + msg); +}); +port.onDisconnect.addListener(() => { + console.log('Disconnected'); +}); +port.postMessage({ text: 'Hello, my_application' }); diff --git a/src/manifest.json b/src/manifest.json index 718ad3a0e8..ac7745dd36 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -89,7 +89,8 @@ "http://*/*", "https://*/*", "webRequest", - "webRequestBlocking" + "webRequestBlocking", + "nativeMessaging" ], "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", "commands": {