General Features
We will now add the same application a second time so we can examine the behaviour of two applications started in parallel.
We override the icon of the second entry to be able to distinguish them and parameterize these two
application entries with the property options
:
apps.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
We modify now our application to respond to these parameters:
apps/testing-buttons.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
Now start "both" application twice to examine the following features.
Arguments
As you see the two application instances have now a different banner text. The object you defined in
options
can be read by the argument options
of the init
method.
Focus Trap
Click on each application window and press the Tab-Button. You will see, the focus will stay always inside the top-most application.
Browser Navigation
Now that you have clicked multple times alternately in each application so that it comes to the front the browser has remembered these actions.
Now click the back button or the forward button multiple times. You will see that the user can navigate back to the last application that he have fronted or forward to the previous fronted application.
ID's
You can even save this history beyond a reload. For this you have to add id's to the application entries and also start the system with an id:
apps.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
|
Now repeat the steps starting the applications and bring them randomly to the front. Then press the reload button.
You will see that the last fronted application will be automatically started. If you click on the back button, the last fronted application will be automatically started and fronted.
Now restart your browser and navigate again to your site. You will see that the browser storage have saved the last active application and it will be started automatically. The history is of course lost.
This behaviour is very important for website look alike sites that we will discuss later. Basically you should always use id's. Otherwise for the system and applications will get randomly generated id's which can under certain circumstances mess up the url.
Setting id's also ensures that you cannot start another system with the same id.