Thanks for pointing me in the right direction.

On Wednesday, June 26, 2013 11:41:05 AM UTC+1, Ben Noordhuis wrote:
>
> On Wed, Jun 26, 2013 at 11:40 AM, Luís Miranda 
> <[email protected]<javascript:>> 
> wrote: 
> > Hi. 
> > I have the following code in javascript: 
> > 
> > var c = new addon.Component(); 
> > c.ComponentLength = 3 
> > 
> > How should i build my addon, so i can do the previous code? I've already 
> > followed the tutorials in http://nodejs.org/api/addons.html , but i'm 
> stuck 
> > here. 
> > 
> > Is this possible? Does anyone have a solution? 
> > 
> > Thanks in advance. 
>
> Something like this: 
>
>   Local<Function> clazz = FunctionTemplate::New(Component::New); 
>   clazz->SetClassName(String::New("Component")); 
>   Local<Function> constructor = clazz->GetFunction(); 
>   Local<Object> instance = constructor->NewInstance(); 
>   instance->Set(String::New("ComponentLength"), Integer::New(3)); 
>
> Where Component::New() should look like this: 
>
>   Handle<Value> Component::New(const Arguments& args) { 
>     assert(args.IsConstructCall() == true); 
>     // Do whatever initialization you need. 
>     return args.This(); 
>   } 
>
> Note that you could set the ComponentLength property in the 
> constructor.  If it's a prototype property, set it through 
> FunctionTemplate::PrototypeTemplate(). 
>
> Have a look at deps/v8/include/v8.h, most of this is documented there. 
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to