This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/royale-docs.git
The following commit(s) were added to refs/heads/master by this push:
new b067285 info on routing
b067285 is described below
commit b06728545e2a7498b0f5e22d8d0a8c7858b14b8d
Author: Harbs <[email protected]>
AuthorDate: Tue Feb 11 10:03:06 2020 +0200
info on routing
---
.../application-tutorial/routing.md | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/create-an-application/application-tutorial/routing.md
b/create-an-application/application-tutorial/routing.md
index c2a0976..831eb2a 100644
--- a/create-an-application/application-tutorial/routing.md
+++ b/create-an-application/application-tutorial/routing.md
@@ -24,6 +24,36 @@ permalink:
/create-an-application/application-tutorial/routing
About Routing
+*needs editing and formatting*
+## Basic Router
+````
+<js:Router id="router" stateChange="hashChanged()"/>
+````
+In the above example, any time the route changes, the `stateChanged` function
will be called.
+
+The state of the router can likewise be changed directly by modifying the
`router.routeState` and calling `router.setState()` `router.renderState()` is a
similar method, but it will dispatched the `stateChanged` event as well and
cause any attached beads to react to the state change as well.
+
+## Router Beads
+The full power of the Router becomes apparent when you use beads. Router can
automatically sync the route state with componet state. It can change which
component is shown by creating and removing components. It can handle
parameters etc. Here are some examples:
+````
+<js:Router localId="router">
+ <js:RouteToState component="{footer}"/>
+ <js:RouteTitleLookup lookup="{getTitleLookup()}"/>
+</js:Router>
+````
+
+In this example, the router syncs the state of the footer with the route path.
The RouteTitleLookup allows changing the window title based on the state. The
`lookup` property is an object whose keys are the state names and the values
are the corresponding titles.
+
+Routers and RouteTotState can be declared on and for more than one component,
so state can be changed and synced across multiple components with ease.
+
+Another example which routes to components: (in progress)
+````
+<js:Router localId="router">
+ <js:RouteToComponent component="{footer}"/>
+ <js:RouteTitleLookup lookup="{getTitleLookup()}"/>
+</js:Router>
+````
+
*Instructions and sample code will appear here soon to show how you can map
URL parameters to different initial values in the application, and vice versa.*