Asynchronously Delay JS Until A Condition Is Met
Answer :
Consider this:
(function wait() { if ( chatroom.json ) { chatroom.render(); } else { setTimeout( wait, 500 ); } })();
This will check every half second.
Live demo: http://jsfiddle.net/kBgTx/
Comments
Post a Comment