drhayes/impactjs-eventchain — pull request #7 by aroth (2014-01-10 16:55:12+00:00)
Title: Add waitUntil(...) mixin.

Unlike wait( n ).orUntil( func ), waitUntil takes a function that must return true before the chain proceeds. Two use cases that have been helpful for my project:

```
// gameplay tutorial scripts
EventChain( this )
.then( function(){ dialogManager.print("Now walk across the room."); } );
.waitUntil( function(){ return player.pos.x > trigger_point.pos.x } )
.then( function(){
dialogManager.next();
dialogManager.print("You got it!");
} );

// dialog management
EventChain( this )
.then( function(){ dialogManager.print("Are you ready?"); } )
.waitUntil( function(){ return dialogManager.dismissed(); } );