Building the main screen
We will start with the code of the application, as it is fairly simple and gives you some context for the rest of the screen. Then, we will dig into the screen Declarative UI and finish off with the CSS for the screen.
JavaScript code
The main screen code is straightforward. We need to require the same application settings as we used in the settings screen to see whether we need to make the settings screen pop up. Then, we will require the observable array, which holds all our messages. Then, we will include a file that deals with our communication, which we will discuss after the screen is done. Let's take a look at the following code snippet:
var appSettings = require('application-settings'); var ObservableArray = require("data/observable-array").ObservableArray; var Socket = require("./AjaxSocket.js").AJAXSocket;
Next, we will define the icon array and the message array. Each of the icon values, such as 0xE0C9
, is easily accessible on the icon fonts website. We will...