Simple pausable function query for node.js