simple and performant js promise implementation