-
Notifications
You must be signed in to change notification settings - Fork 4
Core
OGX.App is the core of the application. It can hold multi stages, windows, popups and an overlay per stage.
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"]
}
The routing for the entire application must be defined in this file. To learn more about the routing system, out the page dedicated to this.
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 load and store your HTML templates into the core, add them to the configuration file, such as
{
...
"templates":{
"Stage1":"template.Stage1.html",
"News":"template.News.html",
"User":"template.User.html",
...
},
...
}
Note that templates must be placed in the www/html/templates folder.
let config = {
scopes:_ARRAY_ //List of current permissions the user has - Defaults to ['public']
};
let app = new OGX.App(config);
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_);
- Welcome
- Changelog
- Structure
- Configuration
- Getting started
- CLI
- Poly
- Core
- Templating
- Routing
- Controllers
- Components
- Extra Components
- Helpers
- Styling
- Debugging