aboutsummaryrefslogtreecommitdiffstats
path: root/extension
diff options
context:
space:
mode:
authorOmar Rizwan <omar.rizwan@gmail.com>2020-12-01 21:46:21 -0800
committerOmar Rizwan <omar.rizwan@gmail.com>2020-12-01 21:47:05 -0800
commitadf4330f5437dcc655936120a3538967c781391e (patch)
tree99e43827d05c2efb85d532424467289057a21c6a /extension
parent976c5ef20aba6be4591824b7ee5e4451b29d9ac6 (diff)
start refactor to use frozen instead of cJSON; I can list dirs, but can't read file yet
also (... at the same time ...) more work on refactoring background.js to eliminate middle layer, I guess
Diffstat (limited to 'extension')
-rw-r--r--extension/background.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/extension/background.js b/extension/background.js
index 3fe2341..643b43b 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -155,7 +155,7 @@ router["/tabs/by-id/*/resources"] = {
}
};
router["/tabs/by-id/*/resources/*"] = {
- async getattr(path) {
+ async getattr({path}) {
const tabId = parseInt(pathComponent(path, -3));
const suffix = pathComponent(path, -1);
@@ -182,10 +182,10 @@ router["/tabs/by-id/*/resources/*"] = {
}
}
},
- async open(path) {
-
+ async open({path}) {
+ // FIXME: cache the file
},
- async read(path, fh, size, offset) {
+ async read({path, fh, size, offset}) {
const tabId = parseInt(pathComponent(path, -3));
const suffix = pathComponent(path, -1);
@@ -210,7 +210,7 @@ router["/tabs/by-id/*/resources/*"] = {
}
throw new UnixError(unix.ENOENT);
},
- async release(path, fh) {
+ async release({path, fh}) {
return {};
}
};
@@ -412,12 +412,12 @@ function findRoute(path) {
let port;
async function onMessage(req) {
- /* console.log('req', req);*/
+ console.log('req', req);
let response = { op: req.op, error: unix.EIO };
/* console.time(req.op + ':' + req.path);*/
try {
- console.log(req.path, req.op, findRoute(req.path)[req.op]);
+ console.log(findRoute(req.path)[req.op]);
response = await findRoute(req.path)[req.op](req);
response.op = req.op;
@@ -430,7 +430,7 @@ async function onMessage(req) {
}
/* console.timeEnd(req.op + ':' + req.path);*/
- /* console.log('resp', response);*/
+ console.log('resp', response);
port.postMessage(response);
};