From bf7d740cdd0a375f1950c38a2f5ccc66375b6030 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Thu, 5 Oct 2023 16:03:44 +0100 Subject: allow watching multiple streams at a time --- index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 88930aa..8350c9c 100644 --- a/index.js +++ b/index.js @@ -72,10 +72,7 @@ function delayP(delay) { }); } -(async () => { - const channel = 'yogscast'; // a random channel - const runForMs = 3600 * 1000; // 1 hour - +async function watch(channel,runForMs=3600 * 1000 /* 1 hour */) { const x = await goThere(channel); const started = Date.now(); @@ -86,4 +83,14 @@ function delayP(delay) { } await x.browser.close(); +} + +const channels = [ 'yogscast', 'yogscast' ]; + +(async () => { + const watchers = channels.map( + (c) => watch(c) + ); + + await Promise.all(watchers); })(); -- cgit v1.2.3