Index

Module: AppWindowManager

AppWindowManager manages the interaction of AppWindow instances.

  • Controll the open/close request of the living appWindow instances.
  • Deliver the resize/orientation lock/setVisible request from LayoutManager/OrientationManager/VisibilityManager to the active appWindow instance.

Methods

static broadcastMessage(message, detail)

Broadcast message to all running app window instances


Used while an event needs to be manipulated by
all running instances. You should register the event handler
in the appWindow as well.

Parameters:
Name Type Argument Description
message String

The message name.

detail Object optional 

The detail of the message.

Example
AppWindowManager.broadcastMessage('earthquake');

AppWindow.prototype._handle__earthquake = function() {
  // Run on my own!
};

AppWindow.REGISTERED_EVENTS.push('_earthquake');

static display(newApp, openAnimation, closeAnimation)

Switch to a different app

Parameters:
Name Type Argument Description
newApp AppWindow

The new app window instance.

openAnimation String optional 

The open animation for opening app.

closeAnimation String optional 

The close animation for closing app.

static init()

The init process from bootstrap to homescreen is opened:
bootstrap



  1. Applications is ready. (mozApps are parsed.)

  2. Bootstrap tells HomescreenLauncher to init.

  3. Homescreen is ready.

  4. Bootstrap tells FTULauncher to fetch FTU(First Time Use app) info.

  5. FTU app is skipped or done.

  6. AppWindowManager open homescreen app via HomescreenLauncher.

static kill(origin)

Kill the running app window by origin


AppWindow instances are responsible to kill theirselves whenever
there's something wrong when the app/page is running.
For example: OOM, crashed, window.close().


When we need to kill a running instance,
we call kill on the instance and let the instance to request 'close'
to AppWindowManager or just destroy itself if it's at background.


AppWindowManager kill process

Parameters:
Name Type Description
origin String

The origin of the running app window to be killed.

static launch(config)

Instanciate app window by configuration

Parameters:
Name Type Description
config AppConfig

The configuration of the app window.

static switchApp(appCurrent, appNext, switching, openAnimation, closeAnimation)

Switch from the current app to the next app.

Parameters:
Name Type Argument Description
appCurrent AppWindow

Displayed appWindow instance.

appNext AppWindow

appWindow instance to be shown.

switching Boolean optional 

Homescreen doesn't involve in the two apps.

openAnimation String optional 

The open animation for opening app.

closeAnimation String optional 

The close animation for closing app.

static uninit()

Remove all event handlers. Currently we only call this function in unit
tests to avoid breaking other tests.