From 35035badb099a52c36ef39e4160bb9fd6c4b8c90 Mon Sep 17 00:00:00 2001 From: anders Date: Wed, 9 Dec 2020 17:26:00 -0600 Subject: [PATCH] fix examples/eventlog.js --- examples/eventlog.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/examples/eventlog.js b/examples/eventlog.js index 835909c..38fddfc 100644 --- a/examples/eventlog.js +++ b/examples/eventlog.js @@ -7,20 +7,17 @@ const creatures = ['🐙', '🐷', '🐬', '🐞', '🐈', '🙉', '🐸', '🐓 console.log("Starting...") -const ipfs = new IPFS({ - repo: './orbitdb/examples/ipfs', - start: true, - EXPERIMENTAL: { - pubsub: true, - }, -}) - -ipfs.on('error', (err) => console.error(err)) - -ipfs.on('ready', async () => { +async function main () { let db try { + const ipfs = await IPFS.create({ + repo: './orbitdb/examples/ipfs', + start: true, + EXPERIMENTAL: { + pubsub: true, + }, + }) const orbitdb = await OrbitDB.createInstance(ipfs, { directory: './orbitdb/examples/eventlog' }) @@ -52,4 +49,5 @@ ipfs.on('ready', async () => { } setInterval(query, 1000) -}) +} +main()