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

21 lines
427 B
TypeScript
Raw Normal View History

import { SyscallContext, SysCallMapping } from "../system";
2022-03-25 11:03:06 +00:00
2022-04-05 15:02:17 +00:00
export function proxySyscalls(
2022-03-25 11:03:06 +00:00
names: string[],
transportCall: (
ctx: SyscallContext,
name: string,
...args: any[]
) => Promise<any>
2022-03-25 11:03:06 +00:00
): SysCallMapping {
let syscalls: SysCallMapping = {};
for (let name of names) {
syscalls[name] = (ctx, ...args: any[]) => {
return transportCall(ctx, name, ...args);
2022-03-25 11:03:06 +00:00
};
}
return syscalls;
}