These seem like a sign that ExportedObject is not a real class, with data and behavior, that you create useful instances of which you keep around and manipulate as objects.
Probably instead you want a function, not a class, which takes an (obj, port) pair and sets its onmessage appropriately.
These seem like a sign that ExportedObject is not a real class, with data and behavior, that you create useful instances of which you keep around and manipulate as objects.
Probably instead you want a function, not a class, which takes an (obj, port) pair and sets its onmessage appropriately.