You could also inherit your own implementation of session store based on
existing one, and alter load method to add your function when session data
loads into memory.
---------
Boris Egorov
skype/gtalk/nickname: dolphin278
mobile: +7 905 728 1543


On Thu, Jul 5, 2012 at 12:00 PM, ec.developer <[email protected]>wrote:

> Thanks for advices =) I think I'll store in session just the static data,
> and object that I need to use will create in other place.
>
> On Thursday, July 5, 2012 12:35:12 AM UTC+3, ec.developer wrote:
>>
>> Hi all,
>> I'm trying to store a class object in a session (I actually use
>> ExpressJS). For class properties everything is fine, but class methods are
>> missed, when I access the object.
>> So for example, I have a class:
>>
>> var SomeClass = module.exports = function() {
>>      this.param1 = "1";
>>      this.param2 = "2";
>>
>>      this.param3 = function(){ return "3"; };
>> }
>>
>> And I instantiate it directly to a session:
>> req.session.myobj = new SomeClass();
>>
>> When the new request is made, I'm trying to access the object
>> req.session.myobj, and I can access only param1 and param2; param3 is
>> unreachable (it is not defined).
>>
>> Is there any way to solve it?
>>
>> Thanks.
>>
>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to