tildefriends/packages/cory/messages/messages.js

15 lines
388 B
JavaScript
Raw Normal View History

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);
});
}