toy implementation of the dom standard promises