Mojo.Controller.StageController

From WebOS101

Revision as of 03:05, 11 November 2009 by BrianMB (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Mojo.Controller.StageController.prototype.pushScene

Can be called with a scene name as the first argument, or a params object. Subsequent arguments will be passed to the scene assistant constructor.

Officially documented params:

  • name: The name of the scene
Mojo.Controller.StageController.pushScene({name:'SceneNameHere'});
  • sceneTemplate: The template to use to render the scene (default is [sceneName]/[sceneName]-scene)
Mojo.Controller.StageController.pushScene({sceneTemplate:'sceneName/sceneName-scene'});
  • disableSceneScroller: set to true to disable the scene scroller that is created by default. This can break widgets like Lists that depend on being contained within a scroller.
Mojo.Controller.StageController.pushScene({disableSceneScroller:'true'});
  • appId: launch the scene from the "name" param from another app instead of this one. The appId (com.whatever.awesomesauce) goes here.
Mojo.Controller.StageController.pushScene({name:'sceneName', appId:'com.whatever.awesomesauce'});
  • transition: the scene transition to use (one of the constants in Mojo.Transition)
Mojo.Controller.StageController.pushScene({transition:'Mojo.Transition.crossFade'});

Remember these can be combined in the same object like so

Mojo.Controller.StageController.pushScene({name:'sceneName', transition:'Mojo.Transition.crossFade', disableSceneScroller:'true'});
  • custom parameters: To add parameters which are passed to your Scene's initialize function as a second argument:
Mojo.Controller.StageController.pushScene(
{name:'sceneName', transition:'Mojo.Transition.crossFade', disableSceneScroller:'true'},
{customProperty: 42, anotherProperty: 'toast'}
);

And to use it in the destination scene:

function SceneNameAssistant(response) {
response.customProperty; //<-- 42
response.anotherProperty; //<-- 'toast'
}

Params that are mentioned in controller_stage.js and controller_scene.js:

  • id - Gives your Scene's <div/> an "id" attribute of your choosing.
  • mojoCrossLaunchPush - probably private
  • automaticFocusAdvance - probably whether to advance focus to the first widget when the scene is activated
  • scrollbars
  • assistantName
  • assistantConstructor
  • allowUndefinedAssistant
Personal tools