Is there any way to inherit a Transcrypt class from a JS prototype? I've got a JS object type that has a fairly heavy set of functionality I need to preserve, but I'd like to extend it with a lot of the nice affordances in a Transcrypt class (in particular, I'd like to supplement clunky JS math functions with Transcript operator overloads).
I've tried the obvious:
class MyClass (MyJSClass):
....
But that doesn't work because the JS class doesn't have Transcrypt's "magic methods".
I've also tried adding methods to the JS prototype:
def add_repr(orig):
def v_repr(self):
return "(inherited JS Object)"
orig.prototype.__repr__ = v_repr
add_repr(MyJSClass)
print (__new__(MyJSClass()))
but in that case the the repr never gets called because Transcrypt is looking for other magic methods or identifiers and doesn't find them so it doesn't go looking for repr
Has anybody worked out a method for either retroactively turning a JS prototype into a Transcrypt class or for inheriting a Transcrypt class from a JS prototype?