Refactor all the things
This commit is contained in:
+7
-11
@@ -10,16 +10,6 @@ export function systemSyscalls(
|
||||
): SysCallMapping {
|
||||
const api: SysCallMapping = {
|
||||
"system.invokeFunction": (
|
||||
ctx,
|
||||
_env: string,
|
||||
name: string,
|
||||
...args: any[]
|
||||
) => {
|
||||
// For backwards compatibility
|
||||
// TODO: Remove at some point
|
||||
return api["system.invoke"](ctx, name, ...args);
|
||||
},
|
||||
"system.invoke": (
|
||||
ctx,
|
||||
name: string,
|
||||
...args: any[]
|
||||
@@ -28,6 +18,12 @@ export function systemSyscalls(
|
||||
throw Error("No plug associated with context");
|
||||
}
|
||||
|
||||
if (name === "server" || name === "client") {
|
||||
// Backwards compatibility mode (previously there was an 'env' argument)
|
||||
name = args[0];
|
||||
args = args.slice(1);
|
||||
}
|
||||
|
||||
let plug: Plug<any> | undefined = ctx.plug;
|
||||
if (name.indexOf(".") !== -1) {
|
||||
// plug name in the name
|
||||
@@ -44,7 +40,7 @@ export function systemSyscalls(
|
||||
}
|
||||
if (functionDef.env && system.env && functionDef.env !== system.env) {
|
||||
// Proxy to another environment
|
||||
return proxySyscall(editor.remoteSpacePrimitives, name, args);
|
||||
return proxySyscall(ctx, editor.remoteSpacePrimitives, name, args);
|
||||
}
|
||||
return plug.invoke(name, args);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user