mirror of
https://github.com/status-im/js-waku-examples.git
synced 2025-01-11 22:44:32 +00:00
move to async/await
Signed-off-by: weboko <anon@mail.com>
This commit is contained in:
parent
88aa19b06f
commit
5bee034de8
@ -32,13 +32,12 @@ async function runApp() {
|
||||
|
||||
ui.onSendMessage(sendMessage);
|
||||
|
||||
ui.onExit(() => {
|
||||
ui.onExit(async () => {
|
||||
ui.setStatus("disconnecting...");
|
||||
unsubscribeFromMessages().then(() => {
|
||||
await unsubscribeFromMessages();
|
||||
ui.setStatus("disconnected");
|
||||
ui.resetMessages();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function initWakuContext({
|
||||
@ -124,13 +123,12 @@ function initUI() {
|
||||
exitButton.addEventListener("click", cb);
|
||||
},
|
||||
onSendMessage: (cb) => {
|
||||
sendButton.addEventListener("click", () => {
|
||||
cb({
|
||||
sendButton.addEventListener("click", async () => {
|
||||
await cb({
|
||||
nick: nickText.value,
|
||||
text: messageText.value,
|
||||
}).then(() => {
|
||||
messageText.value = "";
|
||||
});
|
||||
messageText.value = "";
|
||||
});
|
||||
},
|
||||
// UI renderers
|
||||
|
Loading…
x
Reference in New Issue
Block a user