Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <!-- File > New Project > Templates > JavaScript > Blank App; replace default.html with this -->
- <html>
- <head>
- <meta charset="utf-8" />
- <title>App2</title>
- <!-- WinJS references -->
- <link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" />
- <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
- <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
- <!-- App2 references -->
- <link href="/css/default.css" rel="stylesheet" />
- <script src="/js/default.js"></script>
- </head>
- <body>
- <div id="todo-list" data-win-control="WinJS.UI.ListView"></div>
- <div id="list-template">
- <p data-win-bind="innerText: text"></p>
- </div>
- <script>
- // This is one script module.
- (function () {
- "use strict";
- window.module1Exports = {};
- var templateEl = document.getElementById("list-template");
- window.module1Exports.template = new WinJS.Binding.Template(templateEl);
- }());
- </script>
- <script>
- // This is another module, which initializes the UI.
- (function () {
- "use strict";
- window.module2Exports = {};
- var listEl = document.getElementById("todo-list");
- window.module2Exports.listControl = WinJS.UI.process(listEl).then(function () {
- return listEl.winControl;
- });
- }());
- </script>
- <script>
- // This is a module that contains the data layer
- (function () {
- "use strict";
- window.module3Exports = {};
- var todos = ["fix this bug", "convince Microsoft it's worthwhile"];
- var todoObjects = todos.map(function (text) { return { text: text }; });
- var todoDataSource = new WinJS.Binding.List(todoObjects).dataSource;
- window.module3Exports.todoDataSource = todoDataSource;
- }());
- </script>
- <script>
- // This is the composition module, responsible for composing the results of the other modules.
- (function () {
- "use strict";
- var template = window.module1Exports.template;
- var listControl = window.module2Exports.listControl;
- var todoDataSource = window.module3Exports.todoDataSource;
- listControl.then(function (winControl) {
- WinJS.UI.setOptions(winControl, {
- itemTemplate: template,
- itemDataSource: todoDataSource
- });
- });
- }());
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment