forked from cory/tildefriends
15 lines
388 B
JavaScript
15 lines
388 B
JavaScript
|
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);
|
||
|
});
|
||
|
}
|