1
0
silverbullet/server/syscalls/system.ts
Zef Hemel 561aa6891f
Migrate to Deno (#86)
Big bang migration to Deno 🤯
2022-10-10 14:50:21 +02:00

22 lines
531 B
TypeScript

import { SysCallMapping } from "../../plugos/system.ts";
import type { HttpServer } from "../http_server.ts";
export function systemSyscalls(httpServer: HttpServer): SysCallMapping {
return {
"system.invokeFunction": (
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": () => {
return httpServer.reloadPlugs();
},
};
}