Skip to content

[labs/observers] Consider some refactoring and add Lit directive #2350

Description

@sorvell

There are a few potential feature and refactoring improvements to consider:

  • We want to add a Lit directive for more ergonomically observing elements. This could be a separate module that provides an observeWith(observer) directive. This approach allows the controllers to be used without loading lit-html, but it's a little unergonomic v. something like ${controller.observe()}. If we do the latter, we'll need to disambiguate between using observe as a directive and imperatively. This could be done by checking if an argument is provided.
  • Refine the types associated with the callback and value. These are currently just marked as unknown but they could be handled with a generic. Working this out with the tests will take a bit of refinement.
  • The 4 observer controllers could share a base class. They are similar but each have some differences which need to be carefully considered. There's definitely an opportunity for more code sharing, however.

Activity

  1. changed the title [-][@lit-labs/observers] Consider some refactoring[/-] [+][@lit-labs/observers] Consider some refactoring and add Lit directive[/+] on Dec 9, 2021
  2. self-assigned this
    on Dec 9, 2021
  3. moved this from 🔥 Front Burner to 📋 Triaged in Lit Project Boardon Sep 8, 2022
  4. changed the title [-][@lit-labs/observers] Consider some refactoring and add Lit directive[/-] [+][lit-labs/observers] Consider some refactoring and add Lit directive[/+] on Oct 12, 2022
  5. changed the title [-][lit-labs/observers] Consider some refactoring and add Lit directive[/-] [+][labs/observers] Consider some refactoring and add Lit directive[/+] on Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions