Callback on every block

I want a JavaScript callback to be called every time when a new block is produced. How?