Skip to content
Eric edited this page Apr 25, 2018 · 129 revisions

OGX.App is the core of the application. It can hold multi stages, windows, popups and an overlay per stage.

OGX.JS stack

OGX.App requires a configuration file app.config that must exist in the www folder of your project. If you are using the CLI, the file is automatically created when initialiazing the project by doing ogx init. Otherwise, create that file by hand, here is the skeleton

 {
     "routing":{},
     "stages":{},
     "templates":{},
     "scopes":["public"]         
 }

Routing

Check out the page dedicated to the routing system

Stages

The stages to be added to your app upon start. For instance, if your app is going to have one stage that you have named stage1, and will be using the Stage object Stage1 and the HTML template Stage, then your configuration will look like this

 {
     ...
     "stage1":{"stage":"Stage1", "template":"Stage", "observe":false, "use":true, "home":"stage1/news"}
     ...
 }

The home attribute defines the default route upon start of the application. It MUST have a default route. To know more about routes, click here

Instantiate

 let config = {
      scopes:_ARRAY_  //List of current permissions the user has - Defaults to ['public']
 };
 let app = new OGX.App(config);

Stages

Add a stage to the app

 app.addStage(_STAGE_NAME_, _STAGE_OBJECT, _CONFIG_);

Remove that stage from the app

 app.removeStage(_STAGE_NAME_);

Use another stage (to add/remove views for instance)

 app.useStage(_STAGE_NAME_);

Snooze a stage (all views, windows of this stage)

 app.snoozeStage(_STAGE_NAME_);

Wake a stage (all views, windows of this stage)

 app.wakeStage(_STAGE_NAME_);

Show a stage (and hide the current one if any)

 app.showStage(_STAGE_NAME_, _ANIMATION_);

Add a view to the stage in use

 app.addToStage(_CONFIG_);

Remove a view from the stage in use

 app.removeFromStage(_SELECTOR_);

Clone this wiki locally