lib/bundle.js
/**
 * Create a connection between a sender, signal, and callback.
 */
Create a connection between a sender, signal, and callback.
Create a connection between a sender signal and callback .
function connect(sender, signal, callback, thisArg) {
    thisArg = thisArg || void 0;
    var list = senderMap.get(sender);
    if (list && findConnection(list, signal, callback, thisArg)) {
        return false;
    }
    var conn = new Connection();
    conn.signal = signal;
    conn.callback = callback;
    conn.thisArg = thisArg;
    if (!list) {
        list = new ConnectionList();
        list.first = conn;
        list.last = conn;
        senderMap.set(sender, list);
    }
    else if (list.last === null) {
        list.first = conn;
        list.last = conn;
    }
    else {
        list.last.nextReceiver = conn;
        list.last = conn;
    }
    var receiver = thisArg || callback;
    var head = receiverMap.get(receiver);
    if (head) {
        head.prevSender = conn;
        conn.nextSender = head;
    }
    receiverMap.set(receiver, conn);
    return true;
}
function connect ( sender , signal , callback , thisArg ) { thisArg = thisArg || void 0 ; var list = senderMap . get ( sender ) ; if ( list && findConnection ( list , signal , callback , thisArg ) ) { return false ; } var conn = new Connection ( ) ; conn . signal = signal ; conn . callback = callback ; conn . thisArg = thisArg ; if ( ! list ) { list = new ConnectionList ( ) ; list . first = conn ; list . last = conn ; senderMap . set ( sender , list ) ; } else if ( list . last === null ) { list . first = conn ; list . last = conn ; } else { list . last . nextReceiver = conn ; list . last = conn ; } var receiver = thisArg || callback ; var head = receiverMap . get ( receiver ) ; if ( head ) { head . prevSender = conn ; conn . nextSender = head ; } receiverMap . set ( receiver , conn ) ; return true ; }
Create a connection between a sender, signal, and callback.
Create a connection between a sender signal and callback .
// Coerce a `null` thisArg to `undefined`. // Search for an equivalent connection and bail if one exists. // Create a new connection. // Add the connection to the receivers list. // Add the connection to the senders list.