workadventure/maps/tests/TriggerMessageApi/script.js
David Négrier d1e5d57459 Changing the method name from "triggerMessage" to "displayActionMessage".
Generally speaking, I like to call the message at the bottom an "action message".
And things can "trigger" it, but in the case of a method that actually proactively displays the message, I find "displayActionMessage" to be a better name.

Also, removing package-lock files and improving code style
2021-08-05 09:17:33 +02:00

14 lines
410 B
JavaScript

WA.onInit().then(() => {
let message;
WA.room.onEnterZone("carpet", () => {
message = WA.ui.displayActionMessage("This is a test message. Press space to display a chat message. Walk out to hide the message.", () => {
WA.chat.sendChatMessage("Hello world!", "The bot");
});
});
WA.room.onLeaveZone("carpet", () => {
message && message.remove();
});
});