From 5e020c8862d4ef502f50d0c05afc1622688f116d Mon Sep 17 00:00:00 2001 From: Baud Date: Fri, 31 May 2024 00:33:09 +0100 Subject: [PATCH] _sad cat noises_ --- index.ts | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/index.ts b/index.ts index 8fb2f38..fccf1fc 100644 --- a/index.ts +++ b/index.ts @@ -93,26 +93,20 @@ function handle_message(message: Partial) { }).catch(() => {}) }, 1000) - let connected = false; - while (!connected) { - try { - newHyperdeck.sendCommand(new Commands.DeviceInfoCommand()).then((info) => { - for (let index = 0; index < info.slots; index++) { - setInterval(() => { - newHyperdeck.sendCommand(new Commands.SlotInfoCommand(index)).then((slot) => { - notifyClients({ - event: "record_time_remaining", - hyperdeckId: message.id, - slotId: slot.slotId, - remaining: slot.recordingTime - }) - }).catch(() => {}) - }, 1000) - connected = true; - } - }) - } catch (_err) {} - } + newHyperdeck.sendCommand(new Commands.DeviceInfoCommand()).then((info) => { + for (let index = 0; index < info.slots; index++) { + setInterval(() => { + newHyperdeck.sendCommand(new Commands.SlotInfoCommand(index)).then((slot) => { + notifyClients({ + event: "record_time_remaining", + hyperdeckId: message.id, + slotId: slot.slotId, + remaining: slot.recordingTime + }) + }).catch(() => {}) + }, 1000) + } + }) }) newHyperdeck.on('notify.slot', function (slot) {