仿Promise异步模板
也没什么好说的,使用方法和Promise类似。
class Task { static PENDING = 'pending' static FULFILLED = 'fulFilled' static REJECTED = 'rejected' static WaitResults = [] constructor(executor) { this.status = Task.PENDING this.value = undefined this.reason = undefined this.onResolvedCallbacks = []