Skip to content

AOP in Class implementation #1123

@mourner

Description

@mourner

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

cc @danzel @jacobtoye

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions