A compact implementation of Promise (compatible with when.js)