Create a new native object with a constructor

Braden McDaniel <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
What's the modern way to create a new native object that has a
constructor?

The documentation for JS_NewObject says:

    If clasp has a constructor (JSClass.construct), use
    JS_ConstructObject instead to ensure that the constructor is called.

But JS_ConstructObject is obsolete (and nonexistent in recent
releases).  A note on the doc page for JS_ConstructObject says:

    The preferred alternative is to save a copy of the constructor
    function for the class, then to call it using JS_New.

But that doesn't look like the right answer for a natively implemented
object (since JS_NewObject still does look like part of the answer for
natively implemented objects).

-- 
Braden McDaniel <[email protected]>
_______________________________________________
dev-tech-js-engine mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
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.