跳至主要內容

手撕Promise

Cap原创小于 1 分钟javascript

class MyPromise {

}

const promise1 = new MyPromise((resolve, reject) => {
  setTimeout(() => {
    resolve()
  }, 3000)
})
promise1.then(rs => {

},()=>{}).catch(err => {})