-
Notifications
You must be signed in to change notification settings - Fork 4
Stage
A stage in
OGX.JS
represents the first layer upon which you can add windows, overlays, popups and views. It's like a virtual app. An app can contain more than one stage but only one stage is active at a time. Your app doesn't HAVE to use multiple stages, it really depends on your needs. Consider using a stage when you want to move the user in another part of the app without losing a prior navigation or interaction leading to this action.
For instance, imagine that you are building a social application but you wish to have the messenger part of the app behaving like it is a separate app, without forcing the user to install another app. You can use a second stage here to build a dual application and swap from one stage to the other.
Stages that are put in the background are offloaded off the screen and most of their components (windows, overlays, popups) are snoozed (in a sleep state) but you can still interact with views.
You can create a stage using the CLI, by doing
ogx create stage MyStage
Extends
Uxi, Overlay, Touch, Placeholder
Format
"[name]:[class]":OBJECT
For instance, a stage declared as OML in app.json
"stage1:Stages.Stage":{"template":"Stage", "use":true, "anim":false}
Animations can be use when switching from one stage to the other. If one of the two stages involved has an animation, it is used to transition between the two. If both have an anim, each stage is shown with its own anim.
"anim":false //no anim
"anim":"swap" //vertical swap between stages
"anim":"flip" //vertical flip between stages
Due to the architecture of the framework, a stage must use the following skeleton.
require('Stages.NAME_OF_YOUR_STAGE', 'Stage');
OGX.Stages.NAME_OF_YOUR_STAGE = function(){
construct(this, 'Stages.NAME_OF_YOUR_STAGE');
'use strict';
this.construct = function(__object){
};
};
It is totally acceptable to add methods and variables to a stage even if it is rarely needed.
If you are using the CLI, you can create a new stage by doing
ogx create stage MyStage
- Welcome
- Changelog
- Structure
- Configuration
- Getting started
- CLI
- Poly
- Core
- Templating
- Routing
- Controllers
- Components
- Extra Components
- Helpers
- Styling
- Debugging