code base for javascript promises :)