apps/system/js/task_manager.js
/**
 * The TaskManager shows running windows as a list of cards.
 *
 * When TaskManager is shown, it grabs a copy of StackManager's stack of apps,
 * and instantiates one Card for each AppWindow in the stack.
 *
 * State Management
 * ----------------
 *
 * State updates are handled, waterfall-style, with the following functions:
 *
 * - updateStack()
 *     '- updateLayout()
 *          '- updateScrollPosition()
 *
 * For instance, when the stack changes, we must perform layout; when layout
 * changes, we must update our scroll position. Each function calls the
 * dependent functions itself, to make state updates easy. Simply call the
 * appropriate function corresponding to the highest-level changes needed,
 * and we'll update the appropriate dependent state accordingly:
 *
 * - Call updateStack() when StackManager's stack has changed.
 * - Call updateLayout() when window dimensions change.
 * - Call updateScrollPosition() when the scroll position has changed.
 */
The TaskManager shows running windows as a list of cards.
When TaskManager is shown, it grabs a copy of StackManager's stack of apps,
and instantiates one Card for each AppWindow in the stack.

State Management

State updates are handled, waterfall-style, with the following functions.

- updateStack()
'- updateLayout()
'- updateScrollPosition()

For instance, when the stack changes, we must perform layout; when layout
changes, we must update our scroll position. Each function calls the
dependent functions itself, to make state updates easy. Simply call the
appropriate function corresponding to the highest-level changes needed,
and we'll update the appropriate dependent state accordingly.

- Call updateStack() when StackManager's stack has changed.
- Call updateLayout() when window dimensions change.
- Call updateScrollPosition() when the scroll position has changed.
The TaskManager shows running windows as a list of cards . When TaskManager is shown it grabs a copy of StackManager ' s stack of apps and instantiates one Card for each AppWindow in the stack . State Management State updates are handled waterfall - style with the following functions . - updateStack () ' - updateLayout () ' - updateScrollPosition () For instance when the stack changes we must perform layout ; when layout changes we must update our scroll position . Each function calls the dependent functions itself to make state updates easy . Simply call the appropriate function corresponding to the highest - level changes needed and we ' ll update the appropriate dependent state accordingly . - Call updateStack () when StackManager ' s stack has changed . - Call updateLayout () when window dimensions change . - Call updateScrollPosition () when the scroll position has changed .
function TaskManager() {
  this.appToCardMap = new Map(); 
  this.elementToCardMap = new Map(); 
  this.stack = []; 
  this.currentCard = null;
  this._active = false;
  this.disableScreenshots = false;
}
function TaskManager ( ) { this . appToCardMap = new Map ( ) ; this . elementToCardMap = new Map ( ) ; this . stack = [ ] ; this . currentCard = null ; this . _active = false ; this . disableScreenshots = false ; }
The TaskManager shows running windows as a list of cards.
The TaskManager shows running windows as a list of cards .
// AppWindow -> Card // <div.card> -> Card // a copy of StackManager's stack of AppWindow instances