I am just curious how CasperJS handles events with regards to the call stack.
Let's say we have some code:
casper.on('foo', function() {
this.wait(60000);
this.echo('foo');
});
casper.start('http://www.stackoverflow.com', function() {
this.echo('start');
this.emit('foo');
});
casper.then(function() {
this.echo('done');
});
casper.run();
I know that then() will wait check against 3 flags: pendingWait, loadInProgress, and navigationRequested. Printing out the call stack shows the emit call to be in the function start(), so will start() not be considered finished until the event is finished? I.e. will then() wait until the event has finished
I tested this with wait of 60 seconds, and I did get the output:
start
foo
done
Though I was not sure if exceeding a certain timeout would trigger the next then().