Hi Erik,
I knew I should have looked at your updated library before posting. It
> seems like you do support my scenario above by passing in the proto.
>
> var EventTargetTrait = ...;
>
> function MyComponent() {}
> MyComponent.prototype = Trait.create(
> MySuperClass.prototype, EventTargetTrait);
> ...
>
Your solution is almost right. If you want an object instantiated from a
trait to serve as the prototype of other objects, you should instantiate it
using "Object.create"
"Trait.create" will generate an object whose methods are 'bound' (i.e. their
"this"-binding is fixed). So, self-sends in this object won't delegate back
to "child" objects.
A good way to think of it is that Object.create generates 'plain' Javascript
objects whereas Trait.create generates 'final' objects.
Cheers,
Tom
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss