JS async design patterns