Any examples for reference? or let me know how to make it.
(I already know vtk.js support type definition(by d.ts), but this useful only when I just use vtk class not implement vtk extension class.(am I right?))
Thx for reply.
But there is no guide for make extended class using ‘class keyword’ in that page.
I want to know trick for converting vtk.js’s extend paradigm to typescript’s class extends paradigm.
Unfortunately, the vtk.js classes cannot be extended using ES6 classes. They are instead closure-based classes, not prototype-based ones, and thus require following Julien’s link above.
There was some effort a while back to wrap the vtk.js classes in ES6 classes. Depending on the overhead, revisiting that may pave the way to extending vtk.js classes with the extends keyword.
That effort was not made public, and was more of a demonstration. IIRC it was re-defining the classes, using the original vtk.js objects internally as a delegate.
It seems difficult to reflect the inheritance hierarchy of vtk.js objects(excepting re-define all associated vtk.js objects).
I’m going to implement a class that extends vtk.js object in js, and make type definition file(d.ts) to use it in my app(written in typescript). → Is this the right way?
If there is a better way, please let me know in the comments at any time.