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

Subscribe without activity #3

Open
jakmeier opened this issue Apr 7, 2021 · 0 comments
Open

Subscribe without activity #3

jakmeier opened this issue Apr 7, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@jakmeier
Copy link
Owner

jakmeier commented Apr 7, 2021

Idea:

Allow subscriptions without an activity.

Current Status

With the current API, a subscription can only be created on an activity. This sometimes forces programmers to create a dummy activity to react on a specific message.

Example:

  let dummy = nuts::new_activity(());
  dummy.subscribe(|_: &mut(), msg: &Message| { /*...*/ });

Possible new syntax

  nuts::subscribe(|msg: &Message| { /*...*/ });

Also feasible to add:

  nuts::subscribe_domained(&MyDomain::DomainA, |domain, msg: &Message| { /*...*/ });
@jakmeier jakmeier added the enhancement New feature or request label Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant