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 install #30

Merged
merged 7 commits into from
Nov 4, 2021
Merged

Remove install #30

merged 7 commits into from
Nov 4, 2021

Conversation

keithamus
Copy link
Member

What?

Following from #29 this is a further refactoring that removes the event binding that we do (the r shortcut and copy event), instead opting to document those as patterns. This allows us to remove the AbortController that we added in #29 because instead we can simply delete the install() method, opting for this library to be called imperatively however we want to upstream.

Why?

This offers good separation of concerns: this library is mainly tasked with converting HTML to a markdown quote, and shouldn't also be concerned with event management. To quote the commits:

The code for handling event listening is very trivial, and might vary per consumer of this library. It is not core functionality, and should be left to upstream to setup.

Removing this reduces the API surface area and complexity from this library as it doesn't need to concern itself with event management and keyboard shortcuts.

keithamus and others added 7 commits November 3, 2021 08:57
This DRYs up functionality, pulling some of the complexity out of other
methods.

Co-authored-by: Kate Higa <[email protected]>
This simplifies tests: testing less for side-effects.

Co-authored-by: Kate Higa <[email protected]>
BREAKING CHANGE

The code for handling eventlistening is very trivial, and might vary per
consumer of this library. It is not core functionality, and should be
left to upstream to setup.

Removing this reduces the API surface area and complexity from this library
as it doesn't need to concern itself with event management and keyboard
shortcuts.

Co-authored-by: Keith Cirkel <[email protected]>
BREAKING CHANGE

This was never used upstream, so we want to remove this in the interest
of simplicity.

Co-authored-by: Kate Higa <[email protected]>
Without any event listeners (onCopy and keydown have been removed
prior) AbortController is effectively dead code and can be removed.

Co-authored-by: Keith Cirkel <[email protected]>
Now that all functions can be used independently of `install()`, and
options can be passed into those methods, it makes little sense to have
them in `install()`, and so it can be simplified to just providing the
functionality of collecting containers.

Co-authored-by: Keith Cirkel <[email protected]>
BREAKING CHANGE

`install(container)` was side-effectful behavior which determined where
quote containers would be. A better design for this is to have functions
require a `containerSelector` to query against. This does the same thing
but is slightly more idiomatic.

Co-authored-by: Keith Cirkel <[email protected]>
@keithamus keithamus requested a review from a team as a code owner November 3, 2021 09:03
Copy link
Contributor

@koddsson koddsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. Looks a lot simpler and more focused.

@keithamus keithamus merged commit 4ebc6ba into main Nov 4, 2021
@keithamus keithamus deleted the remove-install branch November 4, 2021 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants