1
0
silverbullet/plugos/syscalls/transport.ts
2022-04-05 17:02:17 +02:00

21 lines
427 B
TypeScript

import { SyscallContext, SysCallMapping } from "../system";
export function proxySyscalls(
names: string[],
transportCall: (
ctx: SyscallContext,
name: string,
...args: any[]
) => Promise<any>
): SysCallMapping {
let syscalls: SysCallMapping = {};
for (let name of names) {
syscalls[name] = (ctx, ...args: any[]) => {
return transportCall(ctx, name, ...args);
};
}
return syscalls;
}