2022-03-07 09:21:02 +00:00
|
|
|
declare global {
|
2022-03-11 10:49:42 +00:00
|
|
|
function syscall(id: number, name: string, args: any[]): Promise<any>;
|
2022-03-14 09:07:38 +00:00
|
|
|
var reqId: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This needs to be global, because this will be shared with all other functions in the same environment (worker-like)
|
|
|
|
if (typeof self.reqId === "undefined") {
|
|
|
|
self.reqId = 0;
|
2022-03-07 09:21:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export async function syscall(name: string, ...args: any[]): Promise<any> {
|
2022-03-14 09:07:38 +00:00
|
|
|
self.reqId++;
|
2022-02-27 09:17:43 +00:00
|
|
|
// console.log("Syscall", name, reqId);
|
2022-03-14 09:07:38 +00:00
|
|
|
return await self.syscall(self.reqId, name, args);
|
2022-02-24 16:24:49 +00:00
|
|
|
}
|