1
0
silverbullet/plugs/core/lib/syscall.ts

22 lines
601 B
TypeScript
Raw Normal View History

2022-03-07 09:21:02 +00:00
declare global {
function syscall(id: string, name: string, args: any[]): Promise<any>;
}
export async function syscall(name: string, ...args: any[]): Promise<any> {
let reqId = "" + Math.floor(Math.random() * 1000000);
2022-02-27 09:17:43 +00:00
// console.log("Syscall", name, reqId);
2022-03-07 09:21:02 +00:00
return await self.syscall(reqId, name, args);
// return new Promise((resolve, reject) => {
// self.dispatchEvent(
// new CustomEvent("syscall", {
// detail: {
// id: reqId,
// name: name,
// args: args,
// callback: resolve,
// },
// })
// );
// });
2022-02-24 16:24:49 +00:00
}