-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Description
We need some simple way to hook into constructors or methods of classes from mixins. Currently a similar thing is only implemented for Map (addInitHook), but other classes often need it too (especially relevant for plugin developers).
One way is to move addInitHook functionality to Class implementation in general — it was added for such cases, it basically puts a function into an array that gets called in the end of the constructor, and you can put event listeners to it. Or come up with some similar AOP-style thing. I didn't see good examples of this in JS libraries though — if you have something in mind, let me know!
Example: https://gist.github.com/4266919