2022-04-03 16:42:12 +00:00
|
|
|
import {SysCallMapping} from "../../plugos/system";
|
|
|
|
import {Space} from "../space";
|
2022-03-25 11:03:06 +00:00
|
|
|
|
|
|
|
export function systemSyscalls(space: Space): SysCallMapping {
|
|
|
|
return {
|
2022-04-03 16:42:12 +00:00
|
|
|
"system.invokeFunctionOnServer": async (
|
|
|
|
ctx,
|
|
|
|
name: string,
|
|
|
|
...args: any[]
|
|
|
|
) => {
|
2022-03-25 11:03:06 +00:00
|
|
|
if (!ctx.plug) {
|
|
|
|
throw Error("No plug associated with context");
|
|
|
|
}
|
2022-03-31 12:28:07 +00:00
|
|
|
return space.remoteInvoke(ctx.plug, name, args);
|
2022-03-25 11:03:06 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|