Announcement

Collapse
No announcement yet.

wait or sleep function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wait or sleep function

    I have alert in my code with sound file but I have another alert right after and it seems only take the first alert but not the second one. Is that I need to delay or wait for few second before execute the second alert?

  • #2
    Hello jchyr,

    We do not have a delay function for this type of scenario. However, you can create one with a loop. Add a delay loop to your study like the below.

    PHP Code:
    function main() {
        
    Alert.playSound("train.wav"):

        var 
    cntr 0;
        for (var 
    04000000i++) {
            
    cntr++
        }
        
    Alert.playSound("ding.wav");

    The number of loops may need to be adjusted for your specific machine. 4 million works well on my end. If you do not hear both alerts, increase the number. If there is too long of a delay between alerts, reduce the number.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment

    Working...
    X