Added support for callback APIs (node.js style).