HTML and CSS Reference
ViewModel.UserData.addItem("Apples", 4, "Whole Foods");
ViewModel.UserData.addItem("Hotdogs", 12, "Costco");
ViewModel.UserData.addItem("Soda", "4 pack", "Costco");
I'll return to the view model in a moment, but first I need to explain some of the other parts
of the code and the conventions they represent. I won't do this for subsequent files, but there is
some useful context to put in place as you get started with Metro development.
Using Code Completion
for code completion for files that are not in the local directory, like this:
/// <reference path="//Microsoft.WinJS.0.6/js/base.js" />
/// <reference path="//Microsoft.WinJS.0.6/js/ui.js" />
Prefixing the reference element with three slash ( / ) characters brings the reference to the
ment. With these additions, code-competition support for the WinJS API is added to the view-
want WinJS completion.
trying to complete code often causes Visual Studio to crash—so much so that I have taken to
Reducing Global Namespace Pollution
defined outside a function are globally available, and since there are only so many meaning-
ful variable names, it is only a matter of time before two different regions of code try to use the
same variable name for different purposes. Global variables are said to be part of the global
namespace , and defining global variables is often described as polluting the global namespace .