Editor refactor: extract system stuff

This commit is contained in:
Zef Hemel
2023-07-14 13:44:30 +02:00
parent 87b0e7e352
commit b39a9b8e22
8 changed files with 240 additions and 190 deletions
+13 -11
View File
@@ -137,17 +137,19 @@ export function Panel({
break;
case "syscall": {
const { id, name, args } = data;
editor.system.localSyscall("core", name, args).then((result) => {
if (!iFrameRef.current?.contentWindow) {
// iFrame already went away
return;
}
iFrameRef.current!.contentWindow!.postMessage({
type: "syscall-response",
id,
result,
});
}).catch((e: any) => {
editor.system.localSyscall(name, args).then(
(result) => {
if (!iFrameRef.current?.contentWindow) {
// iFrame already went away
return;
}
iFrameRef.current!.contentWindow!.postMessage({
type: "syscall-response",
id,
result,
});
},
).catch((e: any) => {
if (!iFrameRef.current?.contentWindow) {
// iFrame already went away
return;