diff options
| author | Li Zhineng <[email protected]> | 2025-07-13 16:24:09 +0800 |
|---|---|---|
| committer | Li Zhineng <[email protected]> | 2025-07-13 16:24:09 +0800 |
| commit | aa757aef706f36afd20da9ec051a1452ab5613ca (patch) | |
| tree | 3f22107eec788f5294567a5426bcb8f9e8f78df5 /main.mjs | |
| parent | f12a332a6d536027c5fc96ef41109215ec769571 (diff) | |
| download | setup-aa757aef706f36afd20da9ec051a1452ab5613ca.tar.gz setup-aa757aef706f36afd20da9ec051a1452ab5613ca.zip | |
Clock.delay
Diffstat (limited to 'main.mjs')
| -rw-r--r-- | main.mjs | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -52,7 +52,7 @@ class Dispatcher { for (let chunk of data) { console.log(`Sending chunk: ${Array.from(chunk).map(b => b.toString(16).padStart(2, '0')).join(' ')}`) await this.#characteristic.writeValueWithResponse(chunk) - await delay(500) + await Clock.delay(500) } } @@ -239,8 +239,10 @@ class RequestIdentityCommand extends Command { } } -async function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)) +class Clock { + static delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) + } } class IncomingMessageHandler { |
