From 5c3dc7ec6c5ee623545a9589ee34541d751b2df9 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 24 Oct 2024 11:38:06 -0600 Subject: [PATCH] clarity --- static/api-demo.html | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/static/api-demo.html b/static/api-demo.html index e0c50db..832897a 100644 --- a/static/api-demo.html +++ b/static/api-demo.html @@ -119,10 +119,8 @@ class Vail extends EventTarget { for (let duration of message.Duration) { let delay = when - now if (tx && (delay >= 0)) { - detail.when = when - detail.duration = duration - setTimeout(() => this.sound(true, detail), delay) - setTimeout(() => this.sound(false, detail), delay + duration) + setTimeout(() => this.sound(true, {when, duration}), delay) + setTimeout(() => this.sound(false, {when: when+duration, duration}), delay + duration) } when += duration tx = !tx @@ -181,7 +179,7 @@ vail.addEventListener("sound", event => log("#sounds", event)) vail.addEventListener("nosound", event => log("#sounds", event)) vail.addEventListener("clients", event => clients(event)) -vail.addEventListener("sound", event => sounds(event, true)) +vail.addEventListener("sound", event => sound(event, true)) vail.addEventListener("nosound", event => sound(event, false)) @@ -197,13 +195,7 @@ vail.addEventListener("nosound", event => sound(event, false))

Implementations should use sound events, which will be dispatched - in the correct order. -

-

- Even though most vail messages only have one duration, - it is valid to have more than one duration. - Use soundevent.detail.duration to obtain the duration - of the sound your client should currently consider. + in the correct order, and only have one duration per event.