It's under control
The data fundamentals are in place, so let's look at a feature we'll be using for the first time in this application: the Controller
. Not a view controller this time, but the over-arching application controller we talked about in our design:
// app/controller/Root.js Ext.define('Postcard.controller.Root', { extend: 'Ext.app.Controller', routes: { 'home': 'onHome', '': 'checkLogin' }, onLaunch: function() { this.checkLogin(); }, checkLogin: function() { if(!window.localStorage.getItem('loggedin')) { this.loginWindow = Ext.create('Postcard.view.login.Login'); } else { Ext.create('Postcard.view.main.Main'); } }, onHome: function() { if(this.loginWindow) { this.loginWindow.destroy(); } this.checkLogin(); } });
In previous examples, app/Application.js
has been responsible for creating the viewport that represents the main view of...