This commit is contained in:
Zef Hemel
2022-04-26 19:04:36 +02:00
parent cb2d3f8652
commit 76636dd9b1
41 changed files with 500 additions and 287 deletions
+21
View File
@@ -0,0 +1,21 @@
import { SysCallMapping } from "@plugos/plugos/system";
import type { ExpressServer } from "../api_server";
export function systemSyscalls(expressServer: ExpressServer): SysCallMapping {
return {
"system.invokeFunction": async (
ctx,
env: string,
name: string,
...args: any[]
) => {
if (!ctx.plug) {
throw Error("No plug associated with context");
}
return ctx.plug.invoke(name, args);
},
"system.reloadPlugs": async () => {
return expressServer.reloadPlugs();
},
};
}