mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
js effect for subscribing to config
fix errors chore: Fix some things in the manager for clippy
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user