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

feat: Add addKnob method to KnobsBuilder #136

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

buehler
Copy link
Contributor

@buehler buehler commented Mar 13, 2024

This was missed in my "opening" of the addKnob method.
Since the KnobsBuilder does not have the method definition
one cannot add custom knobs via custom extension.
This adds the method definition to the builder such
that custom knobs can be added in the future.

@buehler
Copy link
Contributor Author

buehler commented Mar 13, 2024

Hey @ookami-kb
I'm really sorry, I totally missed this small issue. I fixed it in my fork, but forgot to merge it back to the upstream of yours.

It is a very small change that allows custom knobs to be added for sure.

Without this change, the following code is not possible:

extension ButtonKnob on KnobsBuilder {
  T button<T>({
    required String label,
    String? description,
    required T Function() onTap,
  }) =>
      addKnob<T>(
        Knob<T>(
          label: label,
          description: description,
          knobValue: ButtonKnobValue<T>(onTap: onTap),
        ),
      );
}

Because KnobsBuilder does not have the definition of "addKnob".

@ookami-kb ookami-kb changed the title fix(knobs builder): Allow the addKnob method on the abstract builder feat: Add addKnob method to KnobsBuilder Mar 13, 2024
@ookami-kb ookami-kb merged commit 7fd848b into ookami-kb:master Mar 13, 2024
1 check passed
@buehler buehler deleted the fix/add-knob-abstract-method branch March 13, 2024 14:56
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.

2 participants