How to make the page wait for a popup?

0

I've created a method to call a popup to validate an event, but this event happens along with validation.

The popup appears and the event fires. how do I expect the event to pop up?

if(self.Cookie("my_coocke") == undefined){
    self.OpenConfigurationDialog();
    event();
    
asked by anonymous 17.04.2017 / 18:20

1 answer

0

Dude, there are two ways to solve this, either you use the Javascript timeout function or you use PHP Sleep, outside usleep () which delays execution in 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)

Close 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";
?>
    
17.04.2017 / 18:29