function addHandler (p1, p2, onFulfilled, onRejected) {
        // 2.2.1
        if (isFunction(onFulfilled))
            { p2._onFulfilled = onFulfilled; }
        if (isFunction(onRejected)) {
            if (p1[$unhandled]) { emitEvent($rejectionHandled, p1); }

            p2._onRejected = onRejected;
        }

        if (isLongStackTrace) { p2._p = p1; }
        p1[p1._c++] = p2;

        // 2.2.6
        if (p1._s !== $pending)
            { scheduleHandler(p1, p2); }

        // 2.2.7
        return p2;
    }
/**
     * Link the promise1 to the promise2.
     * @private
     * @param {Yaku} p1
     * @param {Yaku} p2
     * @param {Function} onFulfilled
     * @param {Function} onRejected
     */
Link the promise1 to the promise2.
Link the promise1 to the promise2 .
function addHandler (p1, p2, onFulfilled, onRejected) {
        if (isFunction(onFulfilled))
            { p2._onFulfilled = onFulfilled; }
        if (isFunction(onRejected)) {
            if (p1[$unhandled]) { emitEvent($rejectionHandled, p1); }
            p2._onRejected = onRejected;
        }
        if (isLongStackTrace) { p2._p = p1; }
        p1[p1._c++] = p2;
        if (p1._s !== $pending)
            { scheduleHandler(p1, p2); }
        return p2;
    }
function addHandler ( p1 , p2 , onFulfilled , onRejected ) { if ( isFunction ( onFulfilled ) ) { p2 . _onFulfilled = onFulfilled ; } if ( isFunction ( onRejected ) ) { if ( p1 [ $unhandled ] ) { emitEvent ( $rejectionHandled , p1 ) ; } p2 . _onRejected = onRejected ; } if ( isLongStackTrace ) { p2 . _p = p1 ; } p1 [ p1 . _c ++ ] = p2 ; if ( p1 . _s !== $pending ) { scheduleHandler ( p1 , p2 ) ; } return p2 ; }
Link the promise1 to the promise2.
Link the promise1 to the promise2 .
// 2.2.1 // 2.2.6 // 2.2.7