diff options
author | Omar Rizwan <omar.rizwan@gmail.com> | 2020-10-21 15:13:37 -0700 |
---|---|---|
committer | Omar Rizwan <omar.rizwan@gmail.com> | 2020-10-21 15:14:00 -0700 |
commit | 69c167a134bacba2da697099813a45013fa53bcf (patch) | |
tree | 9d7abd1efad8a2ca2118635874286b633a65aea1 /extension/background.js | |
parent | c78377d46442739e48ffd1e418b950b78608e509 (diff) |
native messaging test file.
Diffstat (limited to 'extension/background.js')
-rw-r--r-- | extension/background.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/extension/background.js b/extension/background.js index a53dae0..c7815e6 100644 --- a/extension/background.js +++ b/extension/background.js @@ -289,10 +289,14 @@ async function releasedir(path) { if (route.releasedir) return route.releasedir(path); } +function log(...ss) { + console.log(...ss); +} + let port; /* let ws;*/ async function onMessage(req) { - console.log('req', req); + log('req', req); let response = { op: req.op, error: unix.EIO }; /* console.time(req.op + ':' + req.path);*/ @@ -366,14 +370,16 @@ async function onMessage(req) { } /* console.timeEnd(req.op + ':' + req.path);*/ - console.log('resp', response); - ws.send(JSON.stringify(response)); + log('resp', response); + /* ws.send(JSON.stringify(response));*/ }; function tryConnect() { port = chrome.runtime.connectNative('com.rsnous.TabFS'); - updateToolbarIcon(); + /* console.log('hello', port);*/ + /* updateToolbarIcon();*/ port.onMessage.addListener(onMessage); + port.onDisconnect.addListener(p => {log(p)}); /* ws = new WebSocket("ws://localhost:8888"); * updateToolbarIcon(); |