mirror of https://github.com/nealey/vail.git
clarity
This commit is contained in:
parent
b3b94f7c3c
commit
5c3dc7ec6c
|
@ -119,10 +119,8 @@ class Vail extends EventTarget {
|
||||||
for (let duration of message.Duration) {
|
for (let duration of message.Duration) {
|
||||||
let delay = when - now
|
let delay = when - now
|
||||||
if (tx && (delay >= 0)) {
|
if (tx && (delay >= 0)) {
|
||||||
detail.when = when
|
setTimeout(() => this.sound(true, {when, duration}), delay)
|
||||||
detail.duration = duration
|
setTimeout(() => this.sound(false, {when: when+duration, duration}), delay + duration)
|
||||||
setTimeout(() => this.sound(true, detail), delay)
|
|
||||||
setTimeout(() => this.sound(false, detail), delay + duration)
|
|
||||||
}
|
}
|
||||||
when += duration
|
when += duration
|
||||||
tx = !tx
|
tx = !tx
|
||||||
|
@ -181,7 +179,7 @@ vail.addEventListener("sound", event => log("#sounds", event))
|
||||||
vail.addEventListener("nosound", event => log("#sounds", event))
|
vail.addEventListener("nosound", event => log("#sounds", event))
|
||||||
|
|
||||||
vail.addEventListener("clients", event => clients(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))
|
vail.addEventListener("nosound", event => sound(event, false))
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -197,13 +195,7 @@ vail.addEventListener("nosound", event => sound(event, false))
|
||||||
<div class="log"></div>
|
<div class="log"></div>
|
||||||
<p>
|
<p>
|
||||||
Implementations should use sound events, which will be dispatched
|
Implementations should use sound events, which will be dispatched
|
||||||
in the correct order.
|
in the correct order, and only have one duration per event.
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Even though most vail messages only have one duration,
|
|
||||||
it is valid to have more than one duration.
|
|
||||||
Use <tt>soundevent.detail.duration</tt> to obtain the duration
|
|
||||||
of the sound your client should currently consider.
|
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue