Implement ObservableMixin.decorate() #4958
Labels
package:utils
type:feature
This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone
A common pattern which we use is that in order to make some component's action overridable we implement it using an event. The general flow is like this:
One can then easily listen to that event, modify arguments, cancel it, perform additional actions, etc.
We always did this manually which means adding a bit of ugly code and is not DRY. When talking about https://github.com/ckeditor/ckeditor5-core/issues/88 we thought that
execute()
could be implemented in the same way but we can't have even more code duplication and the commands' code should be as clean as possible.Hence, the idea to implement
OM.decorate()
(big simplification of the decorators idea). It will take care of replacing the original method with a method which fires and event and plugs a listener.EventInfo#return
Part two – implement
EventInfo#return
so you can return fromfire()
. This will be needed for https://github.com/ckeditor/ckeditor5-engine/issues/963 and it makes no sense to work on these two things separately.The text was updated successfully, but these errors were encountered: