Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Open class and Void events #1

Closed
marcguilera opened this issue Sep 8, 2017 · 1 comment
Closed

Open class and Void events #1

marcguilera opened this issue Sep 8, 2017 · 1 comment

Comments

@marcguilera
Copy link

Nice little library. I have two suggestions and I could send a PR if it's something you agree with:

  1. Make the event class open so it can be extended
  2. Make a void event and allow the invoke param to be optional (for param-free type of events)
@svby
Copy link
Owner

svby commented May 20, 2019

I've addressed the first concern somewhat in the latest release. Additionally, a basic event could be implemented with minimal code by delegating the implementation to a collection instance (see SetEvent.kt)

As for the second, I'm not quite sure how this would fit in with the rest of the library. For a void event, I would just use an Event<Unit> and possibly define an extension function as follows:

operator fun Event<Unit>.invoke() = this(Unit)

This should satisfy the "parameterless" event use-case.

@svby svby closed this as completed Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants