src/common/js/winjs/js/ui.js
function _Overlay_showAndHideQueue() {
                    // Only called if not currently animating.
                    // We'll be done with the queued stuff when we return.
                    this._queuedCommandAnimation = false;

                    // Shortcut if hidden
                    if (this.hidden) {
                        this._showAndHideFast(this._queuedToShow, this._queuedToHide);
                        // Might be something else to do
                        Scheduler.schedule(this._checkDoNext, Scheduler.Priority.normal, this, "WinJS.UI._Overlay._checkDoNext");
                    } else {
                        // Animation has 3 parts:  "hiding", "showing", and "moving"
                        // PVL has "addToList" and "deleteFromList", both of which allow moving parts.
                        // So we'll set up "add" for showing, and use "delete" for "hiding" + moving,
                        // then trigger both at the same time.
                        var showCommands = this._queuedToShow;
                        var hideCommands = this._queuedToHide;
                        var siblings = this._findSiblings(showCommands.concat(hideCommands));

                        // Filter out the commands queued for animation that don't need to be animated.
                        var count;
                        for (count = 0; count < showCommands.length; count++) {
                            // If this one's not real or not attached, skip it
                            if (!showCommands[count] ||
                                !showCommands[count].style ||
                                !_Global.document.body.contains(showCommands[count])) {
                                // Not real, skip it
                                showCommands.splice(count, 1);
                                count--;
                            } else if (showCommands[count].style.visibility !== "hidden" && showCommands[count].style.opacity !== "0") {
                                // Don't need to animate showing this one, already visible, so now it's a sibling
                                siblings.push(showCommands[count]);
                                showCommands.splice(count, 1);
                                count--;
                            }
                        }
                        for (count = 0; count < hideCommands.length; count++) {
                            // If this one's not real or not attached, skip it
                            if (!hideCommands[count] ||
                                !hideCommands[count].style ||
                                !_Global.document.body.contains(hideCommands[count]) ||
                                hideCommands[count].style.visibility === "hidden" ||
                                hideCommands[count].style.opacity === "0") {
                                // Don't need to animate hiding this one, not real, or it's hidden,
                                // so don't even need it as a sibling.
                                hideCommands.splice(count, 1);
                                count--;
                            }
                        }

                        // Start command animations.
                        var commandsAnimationPromise = this._baseBeginAnimateCommands(showCommands, hideCommands, siblings);

                        // Hook end animations
                        var that = this;
                        if (commandsAnimationPromise) {
                            // Needed to animate
                            commandsAnimationPromise.done(
                                function () { that._baseEndAnimateCommands(hideCommands); },
                                function () { that._baseEndAnimateCommands(hideCommands); }
                                );
                        } else {
                            // Already positioned correctly
                            Scheduler.schedule(function Overlay_async_baseEndAnimationCommands() { that._baseEndAnimateCommands([]); },
                                Scheduler.Priority.normal, null,
                                "WinJS.UI._Overlay._endAnimateCommandsWithoutAnimation");
                        }
                    }

                    // Done, clear queues
                    this._queuedToShow = [];
                    this._queuedToHide = [];
                }
function _Overlay_showAndHideQueue() {
                    // Only called if not currently animating.
                    // We'll be done with the queued stuff when we return.
                    this._queuedCommandAnimation = false;

                    // Shortcut if hidden
                    if (this.hidden) {
                        this._showAndHideFast(this._queuedToShow, this._queuedToHide);
                        // Might be something else to do
                        Scheduler.schedule(this._checkDoNext, Scheduler.Priority.normal, this, "WinJS.UI._Overlay._checkDoNext");
                    } else {
                        // Animation has 3 parts:  "hiding", "showing", and "moving"
                        // PVL has "addToList" and "deleteFromList", both of which allow moving parts.
                        // So we'll set up "add" for showing, and use "delete" for "hiding" + moving,
                        // then trigger both at the same time.
                        var showCommands = this._queuedToShow;
                        var hideCommands = this._queuedToHide;
                        var siblings = this._findSiblings(showCommands.concat(hideCommands));

                        // Filter out the commands queued for animation that don't need to be animated.
                        var count;
                        for (count = 0; count < showCommands.length; count++) {
                            // If this one's not real or not attached, skip it
                            if (!showCommands[count] ||
                                !showCommands[count].style ||
                                !_Global.document.body.contains(showCommands[count])) {
                                // Not real, skip it
                                showCommands.splice(count, 1);
                                count--;
                            } else if (showCommands[count].style.visibility !== "hidden" && showCommands[count].style.opacity !== "0") {
                                // Don't need to animate showing this one, already visible, so now it's a sibling
                                siblings.push(showCommands[count]);
                                showCommands.splice(count, 1);
                                count--;
                            }
                        }
                        for (count = 0; count < hideCommands.length; count++) {
                            // If this one's not real or not attached, skip it
                            if (!hideCommands[count] ||
                                !hideCommands[count].style ||
                                !_Global.document.body.contains(hideCommands[count]) ||
                                hideCommands[count].style.visibility === "hidden" ||
                                hideCommands[count].style.opacity === "0") {
                                // Don't need to animate hiding this one, not real, or it's hidden,
                                // so don't even need it as a sibling.
                                hideCommands.splice(count, 1);
                                count--;
                            }
                        }

                        // Start command animations.
                        var commandsAnimationPromise = this._baseBeginAnimateCommands(showCommands, hideCommands, siblings);

                        // Hook end animations
                        var that = this;
                        if (commandsAnimationPromise) {
                            // Needed to animate
                            commandsAnimationPromise.done(
                                function () { that._baseEndAnimateCommands(hideCommands); },
                                function () { that._baseEndAnimateCommands(hideCommands); }
                                );
                        } else {
                            // Already positioned correctly
                            Scheduler.schedule(function Overlay_async_baseEndAnimationCommands() { that._baseEndAnimateCommands([]); },
                                Scheduler.Priority.normal, null,
                                "WinJS.UI._Overlay._endAnimateCommandsWithoutAnimation");
                        }
                    }

                    // Done, clear queues
                    this._queuedToShow = [];
                    this._queuedToHide = [];
                }
function _Overlay_showAndHideQueue ( ) { // Only called if not currently animating. // We'll be done with the queued stuff when we return. this . _queuedCommandAnimation = false ; // Shortcut if hidden if ( this . hidden ) { this . _showAndHideFast ( this . _queuedToShow , this . _queuedToHide ) ; // Might be something else to do Scheduler . schedule ( this . _checkDoNext , Scheduler . Priority . normal , this , "WinJS.UI._Overlay._checkDoNext" ) ; } else { // Animation has 3 parts:  "hiding", "showing", and "moving" // PVL has "addToList" and "deleteFromList", both of which allow moving parts. // So we'll set up "add" for showing, and use "delete" for "hiding" + moving, // then trigger both at the same time. var showCommands = this . _queuedToShow ; var hideCommands = this . _queuedToHide ; var siblings = this . _findSiblings ( showCommands . concat ( hideCommands ) ) ; // Filter out the commands queued for animation that don't need to be animated. var count ; for ( count = 0 ; count < showCommands . length ; count ++ ) { // If this one's not real or not attached, skip it if ( ! showCommands [ count ] || ! showCommands [ count ] . style || ! _Global . document . body . contains ( showCommands [ count ] ) ) { // Not real, skip it showCommands . splice ( count , 1 ) ; count -- ; } else if ( showCommands [ count ] . style . visibility !== "hidden" && showCommands [ count ] . style . opacity !== "0" ) { // Don't need to animate showing this one, already visible, so now it's a sibling siblings . push ( showCommands [ count ] ) ; showCommands . splice ( count , 1 ) ; count -- ; } } for ( count = 0 ; count < hideCommands . length ; count ++ ) { // If this one's not real or not attached, skip it if ( ! hideCommands [ count ] || ! hideCommands [ count ] . style || ! _Global . document . body . contains ( hideCommands [ count ] ) || hideCommands [ count ] . style . visibility === "hidden" || hideCommands [ count ] . style . opacity === "0" ) { // Don't need to animate hiding this one, not real, or it's hidden, // so don't even need it as a sibling. hideCommands . splice ( count , 1 ) ; count -- ; } } // Start command animations. var commandsAnimationPromise = this . _baseBeginAnimateCommands ( showCommands , hideCommands , siblings ) ; // Hook end animations var that = this ; if ( commandsAnimationPromise ) { // Needed to animate commandsAnimationPromise . done ( function ( ) { that . _baseEndAnimateCommands ( hideCommands ) ; } , function ( ) { that . _baseEndAnimateCommands ( hideCommands ) ; } ) ; } else { // Already positioned correctly Scheduler . schedule ( function Overlay_async_baseEndAnimationCommands ( ) { that . _baseEndAnimateCommands ( [ ] ) ; } , Scheduler . Priority . normal , null , "WinJS.UI._Overlay._endAnimateCommandsWithoutAnimation" ) ; } } // Done, clear queues this . _queuedToShow = [ ] ; this . _queuedToHide = [ ] ; }
show and hide the queued commands, perhaps animating if overlay isn't hidden.
show and hide the queued commands perhaps animating if overlay isn t hidden .