Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove need for CustomHandler annotations #610

Closed
ifiokjr opened this issue Aug 29, 2020 · 1 comment
Closed

Remove need for CustomHandler annotations #610

ifiokjr opened this issue Aug 29, 2020 · 1 comment
Assignees
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

Comments

@ifiokjr
Copy link
Member

ifiokjr commented Aug 29, 2020

Description

The CustomHandler is pretty ugly.

When setting up an extension you can define options as Handlers and CustomHandlers. Handlers are designed to capture functionality like onChange and onExit. Behind the scenes a handler is just an array that tracks the number of functions that have been added. When using extension.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.

@ifiokjr ifiokjr added 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 labels Aug 29, 2020
@ifiokjr ifiokjr self-assigned this Aug 29, 2020
@ifiokjr ifiokjr added this to To do in remirror@1.0.0 via automation Aug 29, 2020
@ifiokjr ifiokjr added this to Future in Internal Roadmap via automation Aug 29, 2020
@ifiokjr ifiokjr added this to the Core Improvements milestone Aug 29, 2020
@ifiokjr
Copy link
Member Author

ifiokjr commented Sep 5, 2020

After #632 it’s clear to me that there will always be a need for custom handlers and the implementation is too involved to play around with.

@ifiokjr ifiokjr closed this as completed Sep 5, 2020
remirror@1.0.0 automation moved this from To do to Done Sep 5, 2020
Internal Roadmap automation moved this from Future to Released Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Internal Roadmap
  
Released
Development

No branches or pull requests

1 participant