Add 'then' method to Promise.

Attaches a piece of work to do when the promise is fulfilled or
broken. Returns a new Promise that represents the completion of
this extra work, allowing chaining.