This commit is contained in:
Zef Hemel
2022-03-07 10:21:02 +01:00
parent b6046ca974
commit 653e77c4dd
32 changed files with 7274 additions and 323 deletions
+19 -14
View File
@@ -1,16 +1,21 @@
export function syscall(name: string, ...args: any[]): any {
let reqId = Math.floor(Math.random() * 1000000);
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);
// console.log("Syscall", name, reqId);
return new Promise((resolve, reject) => {
self.dispatchEvent(
new CustomEvent("syscall", {
detail: {
id: reqId,
name: name,
args: args,
callback: resolve,
},
})
);
});
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,
// },
// })
// );
// });
}
+1
View File
@@ -19,6 +19,7 @@ async function navigate(syntaxNode: any) {
if (match) {
await syscall("editor.openUrl", match[1]);
}
break;
}
}
+1
View File
@@ -15,6 +15,7 @@ export async function indexLinks({ name, text }: IndexEvent) {
});
}
console.log("Found", backLinks.length, "wiki link(s)");
// throw Error("Boom");
await syscall("indexer.batchSet", name, backLinks);
}