没有状态
function fakepromise(fn) {
var that = this
function f1() {
that.arr[0]()
}
fn(f1)
this.arr = []
this.then = function (fn) {
this.arr.push(fn)
}
}
var p = new fakepromise(function (resolve,reject) {
setTimeout(function () {
console.log('hhh')
resolve()
}, 0)
})
p.then(function () {
console.log('我是then函数里面的')
})