src/calendar.js
function (newTokens, oldTokens) {
                    var i;
                    var token;
                    var replacedTokens = {};
                    var removedTokens = subtractAsSets(oldTokens, newTokens);
                    for (i = 0; i < removedTokens.length; i++) {
                        var removedToken = removedTokens[i];
                        var el = map[removedToken];
                        delete map[removedToken];
                        var newToken = tokenFn(el);
                        // if the element wasn't removed but simply got a new token, its old token will be different from the current one
                        if (newToken === removedToken) {
                            self.onRemoved(el);
                        } else {
                            replacedTokens[newToken] = removedToken;
                            self.onChanged(el);
                        }
                    }

                    var addedTokens = subtractAsSets(newTokens, oldTokens);
                    for (i = 0; i < addedTokens.length; i++) {
                        token = addedTokens[i];
                        if (!replacedTokens[token]) {
                            self.onAdded(map[token]);
                        }
                    }
                }
function (newTokens, oldTokens) {
                    var i;
                    var token;
                    var replacedTokens = {};
                    var removedTokens = subtractAsSets(oldTokens, newTokens);
                    for (i = 0; i < removedTokens.length; i++) {
                        var removedToken = removedTokens[i];
                        var el = map[removedToken];
                        delete map[removedToken];
                        var newToken = tokenFn(el);
                        // if the element wasn't removed but simply got a new token, its old token will be different from the current one
                        if (newToken === removedToken) {
                            self.onRemoved(el);
                        } else {
                            replacedTokens[newToken] = removedToken;
                            self.onChanged(el);
                        }
                    }

                    var addedTokens = subtractAsSets(newTokens, oldTokens);
                    for (i = 0; i < addedTokens.length; i++) {
                        token = addedTokens[i];
                        if (!replacedTokens[token]) {
                            self.onAdded(map[token]);
                        }
                    }
                }
function ( newTokens , oldTokens ) { var i ; var token ; var replacedTokens = { } ; var removedTokens = subtractAsSets ( oldTokens , newTokens ) ; for ( i = 0 ; i < removedTokens . length ; i ++ ) { var removedToken = removedTokens [ i ] ; var el = map [ removedToken ] ; delete map [ removedToken ] ; var newToken = tokenFn ( el ) ; // if the element wasn't removed but simply got a new token, its old token will be different from the current one if ( newToken === removedToken ) { self . onRemoved ( el ) ; } else { replacedTokens [ newToken ] = removedToken ; self . onChanged ( el ) ; } } var addedTokens = subtractAsSets ( newTokens , oldTokens ) ; for ( i = 0 ; i < addedTokens . length ; i ++ ) { token = addedTokens [ i ] ; if ( ! replacedTokens [ token ] ) { self . onAdded ( map [ token ] ) ; } } }
Compare newTokens to oldTokens and call onAdded, onRemoved, and onChanged handlers for each affected event respectively.
Compare newTokens to oldTokens and call onAdded onRemoved and onChanged handlers for each affected event respectively .