Mercurial > browser-couch
diff 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 |
line wrap: on
line diff
--- a/tutorial.html Mon Apr 20 13:38:36 2009 -0700 +++ b/tutorial.html Mon Apr 20 14:30:27 2009 -0700 @@ -86,6 +86,7 @@ }, finished: function(result) { displayInElement(result, 'author-titles-view'); + tryMyView(); } }); } @@ -96,6 +97,39 @@ <div class="example-output" id="author-titles-view"> </div> +<h1>Now You Try!</h1> + +<p>To get a better feel for how MapReduce works, you can use the text +field below to try making your own view. Just press the tab key when +you're done making changes to recompute the view.</p> + +<textarea class="example-code try-code"> +function tryMyView() { + blogDb.view({ + map: function(doc, emit) { + emit(doc.author, doc.title); + }, + reduce: function(keys, values) { + return values; + }, + finished: function(result) { + displayInElement(result, 'try-my-view'); + } + }); +} +</textarea> + +<p>Here's the output to the above view:</p> + +<div class="example-output" id="try-my-view"></div> + +<h1>Where To Go From Here</h1> + +<p>There's features in the API that aren't covered here, so check out +the check out the <a class="intra-wiki" +href="index.html#js/tests.js">annotated source code for the test +suite</a> for more sample code.</p> + <script src="js/ext/jquery.js"></script> <script src="js/browser-couch.js"></script> <script src="js/tutorial.js"></script>