Remove TODO, update code (#518)

This commit is contained in:
Franck R 2022-02-11 16:46:41 +11:00 committed by GitHub
parent f5a693c601
commit b432902fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -19,21 +19,19 @@
* This example demonstrates how to use the js-waku minified bundle * This example demonstrates how to use the js-waku minified bundle
* available on unpkg.com. * available on unpkg.com.
* *
* It is a simple scripts that uses Waku Store to retrieve ping relay messages * It is a simple script that uses Waku Store to retrieve ping relay messages
* and displays the timestamp of the most recent ping relay message. * and displays the timestamp of the most recent ping relay message.
*
* More explanations are provided in this guide (TODO).
*/ */
const timestampDiv = document.getElementById('timestamp'); const timestampDiv = document.getElementById('timestamp');
try { try {
timestampDiv.innerHTML = '<p>Starting waku.</p>'; timestampDiv.innerHTML = '<p>Starting waku.</p>';
jswaku.Waku.create({ bootstrap: true }).catch(e => { jswaku.Waku.create({ bootstrap: { default: true } }).catch(e => {
timestampDiv.innerHTML = 'Failed to create Waku: ' + e.toString(); timestampDiv.innerHTML = 'Failed to create Waku: ' + e.toString();
} }
).then(waku => { ).then(waku => {
timestampDiv.innerHTML = '<p>Connecting to a peer.</p>'; timestampDiv.innerHTML = '<p>Connecting to a peer.</p>';
waku.waitForConnectedPeer() waku.waitForRemotePeer()
.catch((e) => { .catch((e) => {
timestampDiv.innerHTML = 'Failed to connect to peers' + e.toString(); timestampDiv.innerHTML = 'Failed to connect to peers' + e.toString();
}) })