On Tue, Feb 16, 2010 at 9:25 AM, Filipe David Manana <[email protected]> wrote: > Chris, > > looking at render.js: > > function runShow(fun, ddoc, args) { > try { > resetList(); > Mime.resetProvides(); > var resp = fun.apply(ddoc, args) || {};
Cool, looks like the work is already done. If anyone wants to write a version of CommonJS require() that uses 'this' to load code from the ddoc, it looks like the foundations are already laid. Chris > > The scope under which the show function is executed is in fact the design > doc. Same goes for _list, _update and _validate. > > > > On Tue, Feb 16, 2010 at 1:56 AM, J Chris Anderson <[email protected]> wrote: > >> >> the design doc is available in the view server (in everything but map and >> reduce functions), but it's not exposed to the sandbox (yet). >> >> I'd like to make it so the design doc is the value of 'this' when you are >> inside _show, _list, etc functions. >> >> This would be a small patch if anyone is up for it. >> >> Chris >> >> > >> > >> > Cheers, >> > >> > Zach >> >> > > > -- > Filipe David Manana, > [email protected] > PGP key - http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC569452B > > "Reasonable men adapt themselves to the world. > Unreasonable men adapt the world to themselves. > That's why all progress depends on unreasonable men." > -- Chris Anderson http://jchrisa.net http://couch.io
