kanso/duality — Issue #8: setting 'this' in show functions
Author: caolan
Created: 2012-02-05 20:45:46+00:00
State: open

See this issue: kanso/kanso#361

-----

I need to access the design doc attachments array in a show function. But the way kanso wraps the show function, 'this' is not resolving to the design doc.

How my show functions are getting wrapped, in the design doc.

```json
{
"not_found": "function(doc, req){var core = require(\"duality/core\");var fn = require(\"lib/app\")[\"shows\"][\"not_found\"];return core.runShow(fn, doc, req);}",
"recorder.jnlp": "function(doc, req){var core = require(\"duality/core\");var fn = require(\"lib/app\")[\"shows\"][\"recorder.jnlp\"];return core.runShow(fn, doc, req);}"
}
```

maybe we can do

core.runShow.call(this, fn, doc, req)