incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Copenhaver <sean.copenha...@gmail.com>
Subject Re: accessing common data within show function
Date Thu, 21 Jul 2011 11:39:03 GMT
I was going to suggest making a module that had all your static data in it
and just require it in to use. Added benefit of being able to use it in
other design doc functions that support CommonJS modules and also using it
in node.js if you ever needed to.

Sounds like you are doing something similar but navigating the object path
of the design document instead of a require() call.

On Wed, Jul 20, 2011 at 5:47 PM, Vivek Pathak <vpathak@orgmeta.com> wrote:

> It is static data.  thanks, i already got it working by using the "this"
> object within show function (which points to the _design/<designname>
> object) .  eg:
>
> var html = this.common.html.<fld_name> ;
>
>
>
>
>
>
> On 07/20/2011 05:26 PM, Sean Copenhaver wrote:
>
>> Is this data that is constantly changing and would not be present in the
>> document being transformed? Or is this static data?
>>
>> On Wed, Jul 20, 2011 at 5:18 PM, Vivek Pathak<vpathak@orgmeta.com>
>>  wrote:
>>
>>  Hi
>>>
>>> I would like access common data within my show functions.  What I need is
>>> very much like accessing common code using the require() function as
>>> shown
>>> here:  http://wiki.apache.org/****couchdb/CommonJS_Modules<http://wiki.apache.org/**couchdb/CommonJS_Modules>
>>> <http:**//wiki.apache.org/couchdb/**CommonJS_Modules<http://wiki.apache.org/couchdb/CommonJS_Modules>
>>> >.
>>>
>>>  Instead of accessing code, I would like to assign the common data to a
>>> local js variable.
>>>
>>> Is there a simple way to do it?
>>>
>>> Thanks
>>> Vivek Pathak
>>>
>>>
>>
>>


-- 
“The limits of language are the limits of one's world. “ -Ludwig von
Wittgenstein

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message