if (imports.terminal) { core.register("onMessage", function(sender, message) { terminal.print(JSON.stringify(core.user.index), " ", message); }); core.register("onInput", function(input) { core.getService("global").then(function(service) { service.postMessage(input); }); }); } else { core.register("onMessage", function(sender, message) { core.broadcast(message); }); }