# lodash按需加载

https://www.jianshu.com/p/f03ff4f3a8b3

    function reject(reason) { // reason失败态时接收的拒因
        setTimeout(() => {
            // 调用reject 回调对应onRejected函数
            if (that.status === PENDING) {
                // 只能由pending状态 => rejected状态 (避免调用多次resolve reject)
                that.status = REJECTED;
                that.reason = reason;
                that.onRejectedCallbacks.forEach(cb => cb(that.reason));
            }
        });
    }
1
2
3
4
5
6
7
8
9
10
11
lastUpdate: 11/18/2019, 10:16:19 AM