If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Sep 2015
    Member #

    Multiple timers in JS

    I have some home automation I am controlling with JS. I need to wait for the first command to be processed before sending the next.

    So both of these work great:
    <button onclick="SendIR(xxx)">
    <button onclick="SendIR(xxx);setTimeout('SendIR(yyy);',500);">
    The problem arises when I try to send more than 2 commands through a button. I think the second timer is stepping on the first timer (I dont even know is JS supports multiple timers).

    So this does not work:
    <button onclick="SendIR(xxx);setTimeout('SendIR(yyy);',500);setTimeout('SendIR(zzz);',500);">
    Is there a way to use multiple timers or another way I can have several events happen onclick with a pause between each?



  3. #2
    Junior Member
    Join Date
    Sep 2015
    Member #
    Why are you using timers in the first case? Is your function SendIR doing asynchronous stuff?

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 06:58 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: