In Sencha Touch, we can include our application start up logic into following places, this is depending on our application situation.
1. Application default launch function. This launch function is triggered when all the dependencies are loaded successfully.
2. Controller init function.
3. Controller launch function.
4. Profile launch function.
Now I am going to include some code into all the places. Let's see what will happen.
I have created simple controller called "TestController" as shown in figure and I simply printed different message in both init and launch function.
I have created the simple profile called "TestProfile" and I simply printed message in launch function. By default this profile is active.
Now I am going to include my controller and profile into app.js and I am going to simply print different message in application launch function. This is my app.js code.
Ok let's create an index.html file and run our application. This is my index.html code.
The final result of the application is very interesting. This is my application final result.
Ok.. This is the flow of application launch function.
1. Controller init is triggered first.
2. Profile launch function is triggered next.
2. Application launch function is triggered next
3. Finally controller launch function is triggered.