couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haselbach <chr...@mr-co.de>
Subject Re: Making Javascript methods available in views.
Date Mon, 22 Dec 2008 23:41:45 GMT
Benoit Chesneau wrote:
> On Sun, Dec 21, 2008 at 10:17 AM, Christian Haselbach <chriss@mr-co.de> wrote:
>   
>> Is it possible to make custom Javascript methods available in views and
>> actions? For example, I'd like to write a file which defined the methods
>> foo() and bar() so I can use them in my map method of a view. So I do
>> not have to put this functionality into every view that uses it.
>>
>>     
[...]

> you could play with main.js for that I guess.
>   

Thanks for the hint. I guess I'll need it more in actions than in views.
Having certain js libraries available in actions certainly would make
things easier.

BTW, to make it easier (for me) to play around with actions (and design
documents) I wrote a small JS script (requires Rhino) that transforms
javascript objects into JSON objects (using json2.js), converting
functions to strings in the process. I attached it; perhaps someone
things it's useful.

Regards,
Christian

Mime
View raw message