Remove need for CustomHandler
annotations
#610
Labels
package: remirror 🟣
Label for the remirror package and all relevant scoped `@remirror/*` packages.
type: deprecation 🗑️
A public export or internal package has been deprecated.
type: feature ✨
A new feature is being added to the public API
Projects
Milestone
Description
The
CustomHandler
is pretty ugly.When setting up an extension you can define options as
Handlers
andCustomHandlers
. Handlers are designed to capture functionality likeonChange
andonExit
. Behind the scenes a handler is just an array that tracks the number of functions that have been added. When usingextension.options.onChange(value)
the handler will run each of the methods in the handler method array. The handler can also be configured to exit early based on a certain return value.CustomHandler
's were created for situations which needed more customisation. For example,keyBindings
. A keybinding is an object with each key representing a keyboard combination and the value a method that should be called when the combination is active.It's not obvious how you would compose multiple keyboardBindings together and the custom handler was created to enable this situation. However, there are some issues. You no longer have the
extension.options.keyBinding
instead it's up to you how to compose things together.I want to explore whether there might be easier ways of composing the functionality in an automated way as part of the
Handler
option.The text was updated successfully, but these errors were encountered: