js effect for subscribing to config

fix errors

chore: Fix some things in the manager for clippy
This commit is contained in:
Aiden McClelland
2023-02-01 16:53:25 -07:00
parent 93c751f6eb
commit bec307d0e9
18 changed files with 223 additions and 168 deletions

View File

@@ -193,6 +193,18 @@ const diskUsage = async ({
return { used, total }
}
const callbackMapping = {}
const registerCallback = (fn) => {
const uuid = generateUuid(); // TODO
callbackMapping[uuid] = fn;
return uuid
}
const runCallback = (uuid, data) => callbackMapping[uuid](data)
const getServiceConfig = async (serviceId, configPath, onChange) => {
await Deno.core.opAsync("get_service_config", serviceId, configPath, registerCallback(onChange))
}
const currentFunction = Deno.core.opSync("current_function");
const input = Deno.core.opSync("get_input");
const variable_args = Deno.core.opSync("get_variable_args");
@@ -223,6 +235,7 @@ const effects = {
runRsync,
readDir,
diskUsage,
getServiceConfig,
};
const defaults = {