apps/system/js/task_manager.js
/**
   * Hide the Task Manager and return to the AppWindow specified, or the
   * homescreen otherwise.
   */
Hide the Task Manager and return to the AppWindow specified, or the
homescreen otherwise.
Hide the Task Manager and return to the AppWindow specified or the homescreen otherwise .
hide(newApp, animation) {
    if (!this.isShown() || this._isTransitioning) {
      return Promise.resolve();
    }
    this._isTransitioning = true;
    window.removeEventListener('lockscreen-appopened', this);
    window.removeEventListener('attentionopened', this);
    window.removeEventListener('appopen', this);
    window.removeEventListener('appterminated', this);
    window.removeEventListener('wheel', this);
    window.removeEventListener('resize', this);
    this.element.removeEventListener('click', this);
    this.element.removeEventListener('card-will-drag', this);
    this.element.removeEventListener('card-dropped', this);
    this.scrollElement.removeEventListener('scroll', this);
    newApp = newApp ||
      Service.query('AppWindowManager.getActiveWindow') ||
      Service.query('getHomescreen', true);
    this.screenElement.classList.remove('cards-view');
    if (newApp.isHomescreen) {
      this.element.classList.add('to-home');
      newApp.open('home-from-cardview');
    } else {
      newApp.open(animation || 'from-cardview');
    }
    return eventSafety(newApp.element, 'animationend', (e) => {
      this.setActive(false);
      this.publish('cardviewclosed', { detail: newApp });
      this.element.classList.remove('to-home');
      this.element.classList.remove('filtered');
      this.stack.forEach((app) => {
        this._removeApp(app);
      });
      this._isTransitioning = false;
    }, 2000);
  }
hide ( newApp , animation ) { if ( ! this . isShown ( ) || this . _isTransitioning ) { return Promise . resolve ( ) ; } this . _isTransitioning = true ; window . removeEventListener ( 'lockscreen-appopened' , this ) ; window . removeEventListener ( 'attentionopened' , this ) ; window . removeEventListener ( 'appopen' , this ) ; window . removeEventListener ( 'appterminated' , this ) ; window . removeEventListener ( 'wheel' , this ) ; window . removeEventListener ( 'resize' , this ) ; this . element . removeEventListener ( 'click' , this ) ; this . element . removeEventListener ( 'card-will-drag' , this ) ; this . element . removeEventListener ( 'card-dropped' , this ) ; this . scrollElement . removeEventListener ( 'scroll' , this ) ; newApp = newApp || Service . query ( 'AppWindowManager.getActiveWindow' ) || Service . query ( 'getHomescreen' , true ) ; this . screenElement . classList . remove ( 'cards-view' ) ; if ( newApp . isHomescreen ) { this . element . classList . add ( 'to-home' ) ; newApp . open ( 'home-from-cardview' ) ; } else { newApp . open ( animation || 'from-cardview' ) ; } return eventSafety ( newApp . element , 'animationend' , ( e ) => { this . setActive ( false ) ; this . publish ( 'cardviewclosed' , { detail : newApp } ) ; this . element . classList . remove ( 'to-home' ) ; this . element . classList . remove ( 'filtered' ) ; this . stack . forEach ( ( app ) => { this . _removeApp ( app ) ; } ) ; this . _isTransitioning = false ; } , 2000 ) ; }
Hide the Task Manager and return to the AppWindow specified, or the
 homescreen otherwise.
Hide the Task Manager and return to the AppWindow specified or the homescreen otherwise .
// Remove '.cards-view' now, so that the incoming app animation begins its // transition at the proper scale. // Set the proper transition... // ... and when the transition has finished, clean up.