For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
Download from Wow! eBook <www.wowebook.com>
v
Contents at a Glance
About the Authors �������������������������������������������������������������������������������������������������������������� xix
About the Technical Reviewer ������������������������������������������������������������������������������������������� xxi
Acknowledgments ����������������������������������������������������������������������������������������������������������� xxiii
Introduction ���������������������������������������������������������������������������������������������������������������������� xxv
Chapter 1: Welcome to a Touch-First World ■ ����������������������������������������������������������������������1
Chapter 2: The Microsoft Design Language ■ ���������������������������������������������������������������������13
Chapter 3: Designing Windows Store Applications ■ ���������������������������������������������������������29
Chapter 4: Visual Studio 2012 and Windows Store Application Types ■ ����������������������������37
Chapter 5: HTML Controls ■ ������������������������������������������������������������������������������������������������49
Chapter 6: WinJS Controls ■ �����������������������������������������������������������������������������������������������71
Chapter 7: WinJS Collection Controls ■ ������������������������������������������������������������������������������93
Chapter 8: WinJS Custom Controls ■ ��������������������������������������������������������������������������������113
Chapter 9: Building the User Interface ■ ��������������������������������������������������������������������������137
Chapter 10: Transitions and Animations ■ �����������������������������������������������������������������������165
Chapter 11: Data-Binding Concepts ■ ������������������������������������������������������������������������������181
Chapter 12: Promises ■ ����������������������������������������������������������������������������������������������������223
Chapter 13: Web Workers ■ ����������������������������������������������������������������������������������������������269
Chapter 14: Data Source Options ■ �����������������������������������������������������������������������������������287
Chapter 15: Session State and Settings ■ ������������������������������������������������������������������������317
Chapter 16: Files ■ �����������������������������������������������������������������������������������������������������������337
■ Contents at a GlanCe
vi
Chapter 17: Handling State Changes ■ �����������������������������������������������������������������������������361
Chapter 18: External Libraries ■ ���������������������������������������������������������������������������������������383
Chapter 19: Search and Share Contracts ■ ����������������������������������������������������������������������397
Chapter 20: Printing ■ ������������������������������������������������������������������������������������������������������433
Chapter 21: Notifications and Tiles ■ �������������������������������������������������������������������������������459
Chapter 22: Camera and Location ■ ���������������������������������������������������������������������������������485
Chapter 23: Sharing Apps in the Windows Store ■ �����������������������������������������������������������505
Index ���������������������������������������������������������������������������������������������������������������������������������517
xxv
Introduction
When I was asked a few months ago about writing a book on building applications for Windows 8 with JavaScript, my
rst thought was, “What can I bring to the table by writing this book?” Other authors have covered this topic, but as
I reviewed a number of other books, I realized that there was a hole that I could ll by taking on this project.
I wanted to see a book that not only covered the basic technical concepts but one that would also walk a beginner
through the process of building a commercial-quality, real-world application from start to nish. I wanted a book
that not only presented snippets of code but one that also oered tips to improve the user experience of the reader’s
applications. I wanted a book that was more of a tutorial than a reference, introducing concepts that might be new to
the reader, more than digging deeper into familiar topics you might nd in another book. I wanted a book that you
could pick up one day and be building real applications a few days later.
Beginning Windows Store Application Development—HTML and JavaScript Edition is my attempt at providing
a book that I would want to read. I’ve learned a lot while writing this book, and I hope you learn a lot by reading it.
Who This Book Is For
is book is intended for developers who have experience building web applications with HTML, CSS, and JavaScript
and are interested in using their existing skills to build applications for Windows 8. It is also a good beginner’s guide
for those with experience building applications for earlier versions of Windows using other technologies, such as
.NET. Some coverage of HTML, CSS, and JavaScript topics is included for those with less experience, but the focus
of the book is not on those technologies themselves but, instead, using those technologies to build Windows Store
applications.
roughout this book, I’ll remind you that, just like building a web application, you have the freedom to follow
whatever HTML, CSS, and JavaScript practices you prefer. For example, when creating page controls, which will
be rst illustrated in Chapter 5 but used heavily throughout the book, I’ve opted to keep the CSS and JavaScript
le created by Visual Studio in the same directory as the HTML le. Because much of my background is as a .NET
developer, this is familiar, as, by default, Visual Studio keeps ASPX and ASCX les in the same directory as the C#
or VB code behind les. However, you could choose to move all JavaScript les to a js folder and all CSS les to a
css folder. Additionally, you might notice that the JavaScript code that I’ve written isn’t idiomatic JavaScript.
Feel free to modify the code samples to match your coding style.
How This Book Is Structured
While you could certainly skip directly to the topics that interest you, this book was written to be read from beginning
to end, with each chapter building upon the previous. In Chapters 1 through 3, you’ll nd an overview of Windows 8
concepts, such as the touch interface and gestures, and the Microsoft design language. In Chapters 4 through 8,
I’ll introduce you to working with Visual Studio, covering the various project templates available, as well as the
dierent controls you might use in the user interface (UI) of your application.