silverbullet/plug-api/syscall.ts

18 lines
449 B
TypeScript
Raw Normal View History

2024-07-30 23:24:17 +08:00
// declare global {
// function syscall(name: string, ...args: any[]): Promise<any>;
// }
2022-03-14 17:07:38 +08:00
2022-07-04 15:34:11 +08:00
// This is the case when running tests only, so giving it a dummy syscall function
if (typeof self === "undefined") {
2024-07-30 23:24:17 +08:00
(self as any) = {
syscall: () => {
2022-07-04 15:34:11 +08:00
throw new Error("Not implemented here");
},
};
}
// Late binding syscall
export function syscall(name: string, ...args: any[]) {
return (globalThis as any).syscall(name, ...args);
}