Xavier has a good solution with clear usage examples here: https://gist.github.com/xavierlepretre/88682e871f4ad07be4534ae560692ee6. You get a thenable transaction receipt. This is a non-blocking solution, so the javascript thread is not stuck while waiting for the promise to be returned.
It's well-solved using promises and implemented as an extension of web3. Include the code in getTransactionReceiptMined.js verbatim. Then, interact with it as in his examples ... salient excerpt below.
You send a transaction and you get the transaction hash (quick), then call his function to set up a promise to wait for the transaction to be mined (block time). Then, run your code with your mined transaction receipt.
Lifted from his example (with added commentary):
...
// do something that sends a transaction
return meta.sendCoin(account_two, 6, { from: account_one });
})
.then(function (txnHash) {
// now you have the unmined transaction hash, return receipt promise
console.log(txnhash); // follow along
return web3.eth.getTransactionReceiptMined(txnHash);
})
.then(function (receipt) {
// now you have the mined transaction receipt as "receipt"
console.log(receipt); // explore it :-)
// carry on with the next step
return meta.getBalance.call(account_two);
})