synthetic asynchronous processing in javascript