diff options
author | Omar Rizwan <omar.rizwan@gmail.com> | 2018-11-11 11:44:36 -0800 |
---|---|---|
committer | Omar Rizwan <omar.rizwan@gmail.com> | 2018-11-11 11:44:36 -0800 |
commit | 5c2b15068ea11795ebd60de0f4bbb8240c70135f (patch) | |
tree | 4d668c99115e7951ec42829dbb477e37b1d2fb87 /extension | |
parent | 4ca75894c16ea3be1e4c19a7469f1595c18b2f63 (diff) |
Groundwork for response parsing.
Diffstat (limited to 'extension')
-rw-r--r-- | extension/background.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/extension/background.js b/extension/background.js index 3fa39c1..aa10b37 100644 --- a/extension/background.js +++ b/extension/background.js @@ -3,9 +3,13 @@ const ws = new WebSocket("ws://localhost:8888"); ws.onmessage = function(event) { const req = JSON.parse(event.data); - const response = { - names: [".", "..", "hi.txt"] - }; + let response; + if (req.op === "readdir") { + response = { + op: "readdir", + names: [".", "..", "hi.txt"] + }; + } ws.send(JSON.stringify(response)); }; |