incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Lehnardt <...@apache.org>
Subject Re: spidermonkey load function
Date Wed, 12 Aug 2009 21:06:29 GMT

On 12 Aug 2009, at 22:50, Norman Barker wrote:

> ok, (sorry should have been clearer)
>
> I am just looking to add generic functions to main.js - and the
> methods will be added to the sandbox to be available in a view, I also
> do not wish to load arbitrary functions in a view.  I am not looking
> to add many, but main.js is getting big and it would be more
> manageable if we could use load (at the moment I am using a
> pre-processor to create main.js).
>
> Load will be available in main.js, it will not be available in the
> views - the sandbox takes care of that.
>
> I doubt I will be the only one who wants to add generic functions to a
> server since _show has been implemented and generic functionality from
> external libraries would be useful in this application.
>
> It is easier to maintain if generic functions can be added main.js not
> in views as such there either needs to be a pre-process in couchdb to
> create the main.js (so a windows batch file or shell script) or the
> load() function needs to be enabled or main.js is going to grow and
> grow.
>
> Jan, unless I am mistaken CouchApp does not change main.js?

No but it injects code into your view, show and list functions which  
is exactly
what you want. If you change your function library code, views need to
invalidated, if you don't include the code in the functions, CouchDB  
has no
way of knowing.

http://wiki.apache.org/couchdb/Frequently_asked_questions#view_share_code

Cheers
Jan
--


>
> Norman
>
> On Wed, Aug 12, 2009 at 2:07 PM, Jan Lehnardt<jan@apache.org> wrote:
>>
>> On 12 Aug 2009, at 21:08, Norman Barker wrote:
>>
>>> Hi,
>>>
>>> I have been looking at the SpiderMonkey shell and the custom couchdb
>>> javascript driver and see that the couchdb driver does not allow the
>>> load(filename) function which is allowed in the shell, is this
>>> intentional?
>>
>> We don't want users to load extra files in their view code :)
>>
>>
>>> I am looking to add functions to main.js without having to paste  
>>> them
>>> into one file and load() would have been a way around this.  The
>>> alternative is to implement a pre-processor to create one file  
>>> before
>>> deployment which I will use for now.
>>
>> CouchApp* is that preprocessor:
>>
>> http://github.com/couchapp/couchapp/tree/master
>>
>> Cheers
>> Jan
>> --
>>
>>
>


Mime
View raw message