apps/system/js/task_manager.js
/**
   * Show the Task Manager if it is not already visible.
   *
   * @param {boolean} opts.browserOnly
   *   If true, only include browser apps. (Legacy feature)
   */
Show the Task Manager if it is not already visible.
@param {boolean} opts.browserOnly
If true, only include browser apps. (Legacy feature)
Show the Task Manager if it is not already visible . @param { boolean } opts . browserOnly If true only include browser apps . ( Legacy feature )
show(opts) {
    if (this.isShown() || this._isTransitioning) {
      return Promise.resolve();
    }
    this._isTransitioning = true;
    this._browserOnly = opts && opts.browserOnly;
    this.publish('cardviewprepare'); 
    return TaskManagerUtils.waitForScreenToBeReady().then(() => {
      this.publish('cardviewbeforeshow');
      window.addEventListener('lockscreen-appopened', this);
      window.addEventListener('attentionopened', this);
      window.addEventListener('appopen', this);
      window.addEventListener('appterminated', this);
      window.addEventListener('wheel', this);
      window.addEventListener('resize', this);
      this.element.addEventListener('click', this);
      this.element.addEventListener('card-will-drag', this);
      this.element.addEventListener('card-dropped', this);
      this.scrollElement.addEventListener('scroll', this);
      this.scrollElement.style.overflowX = 'hidden';
      this.updateStack();
      this.panToApp(StackManager.getCurrent(), true);
      this.setActive(true);
      var activeApp = Service.query('AppWindowManager.getActiveWindow');
      if (activeApp && activeApp.isHomescreen) {
        activeApp.close('home-to-cardview');
        this.element.classList.add('from-home');
      }
      return TaskManagerUtils.waitForAppToClose(activeApp);
    }).then(() => {
      this.appToCardMap.forEach((card, app) => {
        card.loadIcon();
      });
      this.publish('cardviewshown');
      this.screenElement.classList.add('cards-view');
      this.element.classList.remove('from-home');
      this.scrollElement.style.overflowX = 'scroll';
      this._isTransitioning = false;
    });
  }
show ( opts ) { if ( this . isShown ( ) || this . _isTransitioning ) { return Promise . resolve ( ) ; } this . _isTransitioning = true ; this . _browserOnly = opts && opts . browserOnly ; this . publish ( 'cardviewprepare' ) ; return TaskManagerUtils . waitForScreenToBeReady ( ) . then ( ( ) => { this . publish ( 'cardviewbeforeshow' ) ; window . addEventListener ( 'lockscreen-appopened' , this ) ; window . addEventListener ( 'attentionopened' , this ) ; window . addEventListener ( 'appopen' , this ) ; window . addEventListener ( 'appterminated' , this ) ; window . addEventListener ( 'wheel' , this ) ; window . addEventListener ( 'resize' , this ) ; this . element . addEventListener ( 'click' , this ) ; this . element . addEventListener ( 'card-will-drag' , this ) ; this . element . addEventListener ( 'card-dropped' , this ) ; this . scrollElement . addEventListener ( 'scroll' , this ) ; this . scrollElement . style . overflowX = 'hidden' ; this . updateStack ( ) ; this . panToApp ( StackManager . getCurrent ( ) , true ) ; this . setActive ( true ) ; var activeApp = Service . query ( 'AppWindowManager.getActiveWindow' ) ; if ( activeApp && activeApp . isHomescreen ) { activeApp . close ( 'home-to-cardview' ) ; this . element . classList . add ( 'from-home' ) ; } return TaskManagerUtils . waitForAppToClose ( activeApp ) ; } ) . then ( ( ) => { this . appToCardMap . forEach ( ( card , app ) => { card . loadIcon ( ) ; } ) ; this . publish ( 'cardviewshown' ) ; this . screenElement . classList . add ( 'cards-view' ) ; this . element . classList . remove ( 'from-home' ) ; this . scrollElement . style . overflowX = 'scroll' ; this . _isTransitioning = false ; } ) ; }
Show the Task Manager if it is not already visible.
Show the Task Manager if it is not already visible .
// To prevent race conditions when opening or closing (since both opening // and closing are asynchronous), set this._isTransitioning when we're // either showing or hiding. The flag is cleared during this.setActive(). // Will hide the keyboard if needed // Wait for the screen to rotate into portrait orientation, // and for the keyboard to dismiss completely, if applicable. // Will update and display app screenshots // We only want to paint to critical viewport for now // not the full APZ pre-rendering window // Wait for the current app to signal that it has closed in preparation // for showing the task manager before cleaning things up. // Load app icons asynchronously