The last page a user navigated to, values in a filled out form—these are both things that might be ideal to store in your application session data. We will learn how to store information in session data and then how to read it, restoring the user interface to its last used state.
- View Offline
- Another form of data or storage…that we can work with is session data.…And session data's really great…when a user is midway through something,…for example, filling out a form,…and you want to save their progress,…so that you can restore it if they choose to…navigate away from that page.…And so remember, when you were using the pages,…the pages get added and completely removed.…And so this way, we can go to that data storage,…in terms of session data, take a look,…and then restore and maybe repopulate…some of those fields.…
We're going to do this on the input field on the add page.…So go to add.js,…and the first thing we need to do…is we need to declare…var app is equal to winJS.Application.…We need a reference to the application…because that is where session data lies.…That's how we're going to access it.…On the ready function, we are going to add a listener…to that room input, which is the ID…of that input in the DOM.…And we are going to say addEventListener.…
And the event that we're listening for is input,…and we're going to say…
Watch to gain an understanding of the Universal Windows Platform and the application life cycle. Learn to create adaptive layouts with WinJS controls. Discover how to store and share data, capture a variety of input, and explore the unified Microsoft-specific APIs: Windows Core and Geolocation. Stacey Mulcahy, a Windows evangelist, provides developers with everything they need to start building Universal Windows apps and break into cross-device development.
- Setting up your development environment
- Coding in WinJS
- Creating page objects
- Animating page transitions
- Implementing responsive design principles and UI patterns
- Working with layout controls
- Using APIs: Windows Core and Geolocation
- Saving and reading data