fix import

This commit is contained in:
Sasha 2023-06-20 00:58:39 +02:00
parent 774abec351
commit 20538d471c
No known key found for this signature in database

View File

@ -47,7 +47,8 @@
waitForRemotePeer, waitForRemotePeer,
createEncoder, createEncoder,
createDecoder, createDecoder,
utils, utf8ToBytes,
bytesToUtf8,
} from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js"; } from "https://unpkg.com/@waku/sdk@0.0.16/bundle/index.js";
const peerIdDiv = document.getElementById("peer-id"); const peerIdDiv = document.getElementById("peer-id");
@ -101,7 +102,7 @@
}; };
const callback = (wakuMessage) => { const callback = (wakuMessage) => {
const text = utils.bytesToUtf8(wakuMessage.payload); const text = bytesToUtf8(wakuMessage.payload);
const timestamp = wakuMessage.timestamp.toString(); const timestamp = wakuMessage.timestamp.toString();
messages.push(text + " - " + timestamp); messages.push(text + " - " + timestamp);
updateMessages(messages, messagesDiv); updateMessages(messages, messagesDiv);
@ -124,7 +125,7 @@
const text = textInput.value; const text = textInput.value;
await node.lightPush.send(encoder, { await node.lightPush.send(encoder, {
payload: utils.utf8ToBytes(text), payload: utf8ToBytes(text),
}); });
console.log("Message sent!"); console.log("Message sent!");
textInput.value = null; textInput.value = null;