Re: Is static functions parameter of JS_InitClass working correctly?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Is static functions parameter of JS_InitClass working correctly?

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