1
0
silverbullet/packages/plugos/syscalls/transport.ts

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;
}