Re: Is static functions parameter of JS_InitClass working correctly?
Mihai Dobrescu <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On Sunday, January 10, 2016 at 8:38:44 PM UTC+2, Mihai Dobrescu wrote: > Hi, > > For JS_InitClass, what is the static_fs parameter? > Functions added using it seem not be available. I have thought for a class called Class it would be as static methods for C++, i.e. if I would call a C++ method CClass::StaticMethod(), for functions added in static_fs list to call them in Javascript like Class.StaticMethod(). But it throws an error saying no such method exists. > Actually, if I add methods with the other parameter of JS_InitClass, fs, the methods could be called as true static methods. > What did I misunderstand? > > Regards, > Mike I've found the issue: an even dummy constructor of type JSNative must be passed to JS_InitClass function in order to have instance methods and static methods working.