Class Detail

This class provides methods to manipulate scenes on the stage. A stage is an HTML structure very similar to a standard browser window. A single application may have multiple stages and a single stage may contain multiple scenes.

This class is a constructor which gets instantiated for you, and is typically accessed using this.controller.

Method Summary

Method Detail


Programatically activates this stage. Causes card windows to be maximized.


Returns the SceneController object for the currently active scene from this stage, if any. If no scenes are active, returns undefined.


Programatically deactivates this stage. Causes card windows to be minimized.


Use to call a method on the assistant of the current scene of this stage. The first parameter is the name of the property that contains the function to call. The remaining parameters are passed to that function. The this keyword is bound to the scene assistant for this call.



Returns the current application controller.


Returns an array of scene controllers currently on the stack. result[0] is the bottom scene on the stack.


Gets the orientation of the stage's window.


{Boolean} Mojo.Controller.StageController.hasNewContent()

Returns true if the current stage has new content for the indicator, and false otherwise.


Makes the core navi button pulsate if true. This is mainly intended to alert the user to dashboard events that desire user attention.



Returns true if the stage is both active and has currently pushed.

{Boolean} Mojo.Controller.StageController.isChildWindow()

Utility function to find out if the current window is a child window. Returns true for child windows.


Loads a stylesheet -- and any versions of it for the current locale -- into the stage's document.



Returns the scene assistant of the scene above this scene in the scene stack, or undefined if there is no such scene.


Mojo.Controller.StageController.popScene(returnValue, options)

Removes a scene from the scene stack, passing the return value to the newly revealed scene's activate method. Note that this is an asynchronous operation.


Mojo.Controller.StageController.popScenesTo(targetScene, options)

Removes scenes from the scene stack until the target scene is reached, or there are no scenes remaining on the stack. targetScene may be either the SceneController for the desired scene, the scene DOM ID, or the scene name. If targetScene is undefined, all scenes will be popped. Intermediate popped scenes are not reactivated, nor is there any visual transition to signify their removal from the stack. Note that this is an asynchronous operation.

To avoid showing a transition to the scene if you're already on top, you can use this check:

if (myScene.stageController.topScene() !== myScene.controller) {




This method pushes a scene containing application support information, populated with data gathered from the application's appinfo.json file. It uses the following basic properties from Mojo.appInfo:

Additionally, this method uses a "support" property, which is an object containing at least one of the three following properties:

The "support" object can, optionally, contain a "resources" property; an array of objects with the following properties:

Here is an example appinfo.json:

  "id": "com.mycompany.myapp",
  "version": "1.0.0",
  "vendor": "My Company",
  "vendorurl": "",
  "type": "web",
  "main": "index.html",
  "title": "My App",
  "icon": "icon.png",
  "smallicon": "icon32x32.png",
  "copyright": "© Copyright 2009 My Company, Inc.",
  "support": {
      "url": "",
      "email": {
          "address": "",
          "subject": "Support"
      "phone": "555-555-5555",
      "resources": [
              "type": "scene",
              "label": "Help Topics",
              "sceneName": "topics"
              "type": "web",
              "label": "Discussion Forums",
              "url": ""

Function Call



Adds the given commander to the top of this StageController's stack. The commanders in this stack are only used when this scene is the current scene.



Push a new scene; the Scene Lifecycle initial setup includes this function. Note that this is an asynchronous operation. An app calls StageController.pushScene('myScene'):

  1. A div is created with the view HTML for the new scene, and inserted into the <body>.
  2. A SceneController for 'myScene' is instantiated.
  3. A scene assistant for 'myScene' is instantiated, if available.
  4. The new scene is placed on the stage's scene stack then the Scene Controller and assistant's setup() methods are called and Widgets (divs that specify x-mojo-element) are created, rendered, and added to the DOM.

At this point, scene should now be ready for initial display, even if the app is waiting for a service request to complete to provide dynamic data to fill out the scene.

  1. The StageController transitions the scene onto the stage.
  2. When the transition is complete, the scene controller and assistant's activate method is called, and the scene is ready for action.



Removes a commander from the commander stack.



Sends the given event through the entire command chain, starting with the CommanderStack in the current scene, and progressing to the StageController's stack if the current scene does not call event.stopPropagation().


Mojo.Controller.StageController.setClipboard(escapeHTML:, escapeHTML)

This allows the client application to send text to the clipboard to be pasted elsewhere later.



Sets the orientation of the stage's window.



Changes properties of the window.



Pops the current scene and simultaneously pushed a new scene without activating & deactivating any underlying scenes. Note that this is an asynchronous operation.



Returns the topmost scene from this stage.


Unloads a stylesheet -- and any versions of it for the current locale -- from the stage's document.