Guest User

Untitled

a guest
Oct 18th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <!-- File > New Project > Templates > JavaScript > Blank App; replace default.html with this -->
  3. <html>
  4. <head>
  5. <meta charset="utf-8" />
  6. <title>App2</title>
  7.  
  8. <!-- WinJS references -->
  9. <link href="//Microsoft.WinJS.1.0.RC/css/ui-dark.css" rel="stylesheet" />
  10. <script src="//Microsoft.WinJS.1.0.RC/js/base.js"></script>
  11. <script src="//Microsoft.WinJS.1.0.RC/js/ui.js"></script>
  12.  
  13. <!-- App2 references -->
  14. <link href="/css/default.css" rel="stylesheet" />
  15. <script src="/js/default.js"></script>
  16. </head>
  17. <body>
  18. <div id="todo-list" data-win-control="WinJS.UI.ListView"></div>
  19. <div id="list-template">
  20. <p data-win-bind="innerText: text"></p>
  21. </div>
  22.  
  23. <script>
  24. // This is one script module.
  25. (function () {
  26. "use strict";
  27. window.module1Exports = {};
  28.  
  29. var templateEl = document.getElementById("list-template");
  30. window.module1Exports.template = new WinJS.Binding.Template(templateEl);
  31. }());
  32. </script>
  33.  
  34. <script>
  35. // This is another module, which initializes the UI.
  36. (function () {
  37. "use strict";
  38. window.module2Exports = {};
  39.  
  40. var listEl = document.getElementById("todo-list");
  41.  
  42.  
  43. window.module2Exports.listControl = WinJS.UI.process(listEl).then(function () {
  44. return listEl.winControl;
  45. });
  46. }());
  47. </script>
  48.  
  49. <script>
  50. // This is a module that contains the data layer
  51. (function () {
  52. "use strict";
  53. window.module3Exports = {};
  54.  
  55. var todos = ["fix this bug", "convince Microsoft it's worthwhile"];
  56. var todoObjects = todos.map(function (text) { return { text: text }; });
  57. var todoDataSource = new WinJS.Binding.List(todoObjects).dataSource;
  58.  
  59. window.module3Exports.todoDataSource = todoDataSource;
  60. }());
  61. </script>
  62.  
  63. <script>
  64. // This is the composition module, responsible for composing the results of the other modules.
  65. (function () {
  66. "use strict";
  67. var template = window.module1Exports.template;
  68. var listControl = window.module2Exports.listControl;
  69. var todoDataSource = window.module3Exports.todoDataSource;
  70.  
  71. listControl.then(function (winControl) {
  72. WinJS.UI.setOptions(winControl, {
  73. itemTemplate: template,
  74. itemDataSource: todoDataSource
  75. });
  76. });
  77. }());
  78. </script>
  79. </body>
  80. </html>
Add Comment
Please, Sign In to add comment