This commit is contained in:
Franck Royer 2021-08-02 12:14:30 +10:00
parent ef27afbbf9
commit dbc6662082
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ function App() {
const sendMessageOnClick = () => { const sendMessageOnClick = () => {
if (wakuStatus !== 'Ready') return; if (wakuStatus !== 'Ready') return;
sendMessage(`Here is message #${sendCounter}`, waku, new Date()).then(() => sendMessage(`Here is message #${sendCounter}`, new Date(), waku).then(() =>
console.log('Message sent') console.log('Message sent')
); );
@ -100,7 +100,7 @@ async function bootstrapWaku(waku) {
await Promise.all(nodes.map((addr) => waku.dial(addr))); await Promise.all(nodes.map((addr) => waku.dial(addr)));
} }
async function sendMessage(message, waku, timestamp) { async function sendMessage(message, timestamp, waku) {
const time = timestamp.getTime(); const time = timestamp.getTime();
const payload = proto.SimpleChatMessage.encode({ const payload = proto.SimpleChatMessage.encode({

View File

@ -54,7 +54,7 @@ function App() {
React.useEffect(() => { React.useEffect(() => {
// If Waku is already assigned, the job is done // If Waku is already assigned, the job is done
if (!!waku) return; if (!!waku) return;
// If Waku status not None, it means we already started Waku // If Waku status not None, it means we are already starting Waku
if (wakuStatus !== 'None') return; if (wakuStatus !== 'None') return;
setWakuStatus('Starting'); setWakuStatus('Starting');
@ -147,7 +147,7 @@ import { WakuMessage } from 'js-waku';
const ContentTopic = `/min-js-web-chat/1/chat/proto`; const ContentTopic = `/min-js-web-chat/1/chat/proto`;
async function sendMessage(message, waku, timestamp) { async function sendMessage(message, timestamp, waku) {
const time = timestamp.getTime(); const time = timestamp.getTime();
// Encode to protobuf // Encode to protobuf