How to make the page wait a pop-up?

Asked

Viewed 78 times

0

I created a method to call a pop-up to validate an event, but this event happens along with validation.

The pop-up appears and the event fires. how do I wait for the pop-up event?

if(self.Cookie("my_coocke") == undefined){
    self.OpenConfigurationDialog();
    event();

1 answer

0

Dude, there are two ways to solve this, either you use the Javascript timeout function or you use PHP Sleep, apart from usleep() which Delays execution by millionths of a second.

Ex Javascript:

setTimeout(function() { console.log("setTimeout: Ja passou 1 segundo!"); }, 1000);
setInterval(function() { console.log("setInterval: Ja passou 1 segundo!"); }, 1000);

What the code prints on the screen:

setTimeout: Ja passou 1 segundo!
setInterval: Ja passou 1 segundo!
setInterval: Ja passou 1 segundo!
setInterval: Ja passou 1 segundo!
setInterval: Ja passou 1 segundo!
...

Deepening:

var recursiva = function () {
    console.log("Se passaram 1 segundo!");
    setTimeout(recursiva,1000);
}
recursiva();

Ex Sleep PHP

int Sleep ( int $Seconds )

Next view of coding

<?php
// Hora atual
echo date('h:i:s') . "\n";

// Dorme por 10 segundos
sleep(10);

// Acorde!
echo date('h:i:s') . "\n";
?>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.