comparison tutorial.html @ 78:17ce8b6be452

Added a 'now you try' section and a 'where to go from here' section to the tutorial.
author Atul Varma <varmaa@toolness.com>
date Mon, 20 Apr 2009 14:30:27 -0700
parents 4450be5d1b2f
children 042eb025bce5
comparison
equal deleted inserted replaced
77:5d413eab9aab 78:17ce8b6be452
84 reduce: function(keys, values) { 84 reduce: function(keys, values) {
85 return values; 85 return values;
86 }, 86 },
87 finished: function(result) { 87 finished: function(result) {
88 displayInElement(result, 'author-titles-view'); 88 displayInElement(result, 'author-titles-view');
89 tryMyView();
89 } 90 }
90 }); 91 });
91 } 92 }
92 </div> 93 </div>
93 94
94 <p>The output is as follows:</p> 95 <p>The output is as follows:</p>
95 96
96 <div class="example-output" id="author-titles-view"> 97 <div class="example-output" id="author-titles-view">
97 </div> 98 </div>
98 99
100 <h1>Now You Try!</h1>
101
102 <p>To get a better feel for how MapReduce works, you can use the text
103 field below to try making your own view. Just press the tab key when
104 you're done making changes to recompute the view.</p>
105
106 <textarea class="example-code try-code">
107 function tryMyView() {
108 blogDb.view({
109 map: function(doc, emit) {
110 emit(doc.author, doc.title);
111 },
112 reduce: function(keys, values) {
113 return values;
114 },
115 finished: function(result) {
116 displayInElement(result, 'try-my-view');
117 }
118 });
119 }
120 </textarea>
121
122 <p>Here's the output to the above view:</p>
123
124 <div class="example-output" id="try-my-view"></div>
125
126 <h1>Where To Go From Here</h1>
127
128 <p>There's features in the API that aren't covered here, so check out
129 the check out the <a class="intra-wiki"
130 href="index.html#js/tests.js">annotated source code for the test
131 suite</a> for more sample code.</p>
132
99 <script src="js/ext/jquery.js"></script> 133 <script src="js/ext/jquery.js"></script>
100 <script src="js/browser-couch.js"></script> 134 <script src="js/browser-couch.js"></script>
101 <script src="js/tutorial.js"></script> 135 <script src="js/tutorial.js"></script>
102 </body> 136 </body>
103 </html> 137 </html>