silverbullet/plug-api/syscall.ts

17 lines
400 B
TypeScript
Raw Normal View History

2022-03-07 17:21:02 +08:00
declare global {
2022-03-24 17:48:56 +08:00
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") {
// @ts-ignore: test
// deno-lint-ignore no-global-assign
2022-07-04 15:34:11 +08:00
self = {
syscall: () => {
2022-07-04 15:34:11 +08:00
throw new Error("Not implemented here");
},
};
}
export const syscall = globalThis.syscall;