2022-02-27 09:17:43 +00:00
|
|
|
export function syscall(name: string, ...args: any[]): any {
|
|
|
|
let reqId = Math.floor(Math.random() * 1000000);
|
|
|
|
// console.log("Syscall", name, reqId);
|
|
|
|
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
|
|
|
}
|