I have a class, ChatRoom, that can only render after it receives a long-running HTTP request (it could take 1 second or 30 seconds). So I need to delay rendering un
ChatRoom
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/