3 ms·
good find the code should be updated to: <button _="on pointerdown repeat until event stopCycling set rand to Math.random()
by recursivedoubts 4y ago
good find
the code should be updated to:
<button _="on pointerdown
repeat until event stopCycling
set rand to Math.random() * 255
transition *background-color to `hsl($rand 100% 90%)` over 250ms
end
on pointerup or mouseleave
trigger stopCycling">
Click And Hold Me
</button>
to capture both the pointerup and mouseleave events (seems like some browsers trigger the pointerup event even if the mouse/pointer has left the element)
unfortunately right now the `repeat until event` form doesn't take multiple events, so we have to kick out to another event handler to capture both. I'll try to fix that in the next release.