apps/system/js/task_manager.js
/**
   * Update our stack and list of cards to match StackManager.
   * Call this whenever we think the stack has changed; this function will
   * take care of updating the layout and card positions.
   */
Update our stack and list of cards to match StackManager.
Call this whenever we think the stack has changed; this function will
take care of updating the layout and card positions.
Update our stack and list of cards to match StackManager . Call this whenever we think the stack has changed ; this function will take care of updating the layout and card positions .
updateStack({ currentlyLaunchingApp } = {}) {
    this.stack = StackManager.snapshot();
    if (this._browserOnly) {
      this.stack = this.stack.filter((app) => {
        return app.isBrowser() ||
          (app.manifest && app.manifest.role === 'search');
      });
    }
    document.l10n.setAttributes(this.noRecentWindowsEl,
      this._browserOnly ?
        'no-recent-browser-windows' : 'no-recent-app-windows');
    this.element.classList.toggle('filtered', !!this._browserOnly);
    this.element.classList.toggle('empty', this.stack.length === 0);
    var latestAppSet = new Set(this.stack);
    this.appToCardMap.forEach((card, app) => {
      if (!latestAppSet.has(app)) {
        this._removeApp(app);
      }
    });
    var toAdd = this.stack.filter((app) => {
      return !this.appToCardMap.get(app);
    });
    if (toAdd.length) {
      var fragment = document.createDocumentFragment();
      toAdd.forEach((app) => {
        this._addApp(app, fragment, {
          stayInvisible: (app === currentlyLaunchingApp)
        });
      });
      this.cardsList.appendChild(fragment);
    }
    this.updateLayout(toAdd.length === this.stack.length);
  }
updateStack ( { currentlyLaunchingApp } = { } ) { this . stack = StackManager . snapshot ( ) ; if ( this . _browserOnly ) { this . stack = this . stack . filter ( ( app ) => { return app . isBrowser ( ) || ( app . manifest && app . manifest . role === 'search' ) ; } ) ; } document . l10n . setAttributes ( this . noRecentWindowsEl , this . _browserOnly ? 'no-recent-browser-windows' : 'no-recent-app-windows' ) ; this . element . classList . toggle ( 'filtered' , ! ! this . _browserOnly ) ; this . element . classList . toggle ( 'empty' , this . stack . length === 0 ) ; var latestAppSet = new Set ( this . stack ) ; this . appToCardMap . forEach ( ( card , app ) => { if ( ! latestAppSet . has ( app ) ) { this . _removeApp ( app ) ; } } ) ; var toAdd = this . stack . filter ( ( app ) => { return ! this . appToCardMap . get ( app ) ; } ) ; if ( toAdd . length ) { var fragment = document . createDocumentFragment ( ) ; toAdd . forEach ( ( app ) => { this . _addApp ( app , fragment , { stayInvisible : ( app === currentlyLaunchingApp ) } ) ; } ) ; this . cardsList . appendChild ( fragment ) ; } this . updateLayout ( toAdd . length === this . stack . length ) ; }
Update our stack and list of cards to match StackManager.
Update our stack and list of cards to match StackManager .