Re: Create a new native object with a constructor

Josh Matthews <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 2016-06-20 7:06 AM, Braden McDaniel wrote:
> On a related note, the JS_InitClass documentation includes this:
>
>     If you provide a constructor for the class, then you should also
>     pass an object to parent_proto. JS_InitClass uses parent_proto to
>     build a prototype object for the class. The prototype object
>     inherits properties and methods from the parent_proto object you
>     provide.
>
> I gather, then, that passing null for parent_proto is insufficient even
> if the parent is Object? Is there some convenient way to get the proto
> for Object in order to pass it here?

You're looking for JS_GetObjectPrototype.

Cheers,
Josh
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.