You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when we want to mix both DomEmitterMixin and ObservableMixin:
classMyClass{ ... }mix(MyClass,DomEmitterMixin);mix(MyClass,ObservableMixin);// won't work, because listenTo must be identical in all super-interfaces:// interface MyClass extends DomEmitter, Observable {}// But type intersection works differently, so let's use that:typeObservableDomEmitter=DomEmitter&Observable;interfaceMyClassextendsObservableDomEmitter{}exportdefaultMyClass;
This could be made backward-compatible (XyzMixin functions would have all the methods also exposed on the function object itself, at least for the existing mixins).
The text was updated successfully, but these errors were encountered:
CKEditorBot
added
status:planned
Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon.
status:in-progress
Set automatically when an issue lands in the "In progress" column. We are working on it.
and removed
status:planned
Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon.
labels
Jul 19, 2022
Other (utils): Introduces new way to apply mixins. Instead of using mix() util, classes should extend the base created by EmitterMixin(), ObservableMixin() and DomEmitterMixin() or extend Emitter or Observable directly. Closes#12077.
There are two styles of mixins suggested by TypeScript Handbook: suggested and alternative one.
Currently, the usage of mixins in ckeditor5 looks like:
After migration to TypeScript, we could use the alternative pattern and translate the above into:
However, when we want to mix both
DomEmitterMixin
andObservableMixin
:This is doable, but seems like a hack. I propose to use the pattern from handbook:
This could be made backward-compatible (
XyzMixin
functions would have all the methods also exposed on the function object itself, at least for the existing mixins).The text was updated successfully, but these errors were encountered: