Java Reference
In-Depth Information
update: update,
hide: hide,
show: show
This defines the functions and then returns an object that has references to the DOM ele-
ments as its properties and the function definitions as its methods.
Everything to do with the view is now self-contained. To access the form element, we
would now use view.form and to call the update() function we'd use
view.update() . We now need to go through the rest of our code and update it to use
these new names, which requires making the following changes:
update becomes view.update
hide becomes view.hide
show becomes
• all the $ symbols become view. (for example, $timer becomes view.timer )
By separating the view logic into a separate module, we are moving towards an MVC-style
structure. The Game object acts as the model and the event handlers act as controllers that
take care of all the different interactions with the player.
The final task we'll do with our quiz game is prepare it for deployment. This will involve
removing the console.log statements and minifying the code. To make this easier,
we'll use a Gulp task to automate the process.
In order to use Gulp, you'll need to install Node.js. Then use npm to install Gulp via the
terminal as follows:
$ npm install --g gulp
From your project folder, you must then initialize the project using:
Search WWH ::

Custom Search