LexiFi / gen_js_api

Easy OCaml bindings for Javascript libraries
MIT License
177 stars 31 forks source link

Inherit JS class, override method and pass new class back to JS? #156

Open Lupus opened 3 years ago

Lupus commented 3 years ago

It's possible to wrap JS class with OCaml one, and it's possible to have some other OCaml class inherit from that base JS class and provide alternative implementation for some methods (which is the point of, well, subclassing). From the documentation it's not clear if it's possible to have that inherited class passed back to JS, so that my overriden methods will get called when JS calls corresponding methods of JS class? 🤔

Lupus commented 3 years ago

Seems that virtual classes are not accepted by gen_js_api 😞