Restart/interupt the sleep function

  • needtheanswers-1328080452048785491

    needtheanswers

    27 days ago

    Is there a way to restart the sleep function? For example you click a button which triggers sleep 5000ms, after 2000ms you click the button again and it should start at 5000ms again.
  • jacobkofoed-1328330462254338051

    Jacob Kofoed

    26 days ago

    There is no built in way as far as I know, but you should be able to achieve this with workflows and a variable counter to set up your own debounce pattern. I've set up an example here where even if you click many times, it will only fire at most once every 500ms. It starts a new sleep on each click, but each they do not trigger their callback if another sleep has been started afterwards, but comparing the index of its own click with the latest one. https://toddle.dev/projects/olive_watto_inquisitive_buzzard/branches/start/components/HomePage?mode=design&leftpanel=design&rightpanel=style&canvas-width=824&canvas-height=800

    I hope it makes sense, let me know if you need more explanation.
    ๐Ÿ”ฅ1
  • needtheanswers-1328352848416866414

    needtheanswers

    26 days ago

    @Jacob Kofoed Just tested it out and this is working perfectly fine, thank you very much ๐Ÿ™

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code โ€” but accessible to your entire team!

Try toddle โ€” it's free!

ยฉ Copyright 2024 toddle. All rights reserved.