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

Add notes about ensure/debounceEvent not supporting async events #288

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

julienma
Copy link

@julienma julienma commented Sep 20, 2018

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have added tests that prove my fix is effective or that my feature works.
  • I have added all necessary documentation (if appropriate)

What was done

Add a note in the docs that we don't currently support async events, cf. #286 (comment).

Associated Issues

❤️ Thanks

Thanks for taking the time to help out with the project, it's much appreciated 🙂

@ttmarek
Copy link
Contributor

ttmarek commented Sep 20, 2018

Thanks so much for this!

The additions to the ensure doc are perfect. But, debounceEvent actually should work with async events. If possible, could you remove those changes and just leave the additions to the ensure docs?

@julienma
Copy link
Author

Oh, sure.

But, what you mean is that I should be able to do this?

const emitEvent1 = debounceEvent(60*1000, emitEvent1Validated);
const emitEvent1Validated = ensure(validator,
  logEvent((action) => ({
    type: 'My Event'
  }))
);

I'm pretty sure I tried both debounceEvent(100, ensure(...)) and ensure(validator, debounceEvent(...)), and couldn't make it work any way.

I'm waiting for your confirmation before rolling back e3dbf64.

@ttmarek
Copy link
Contributor

ttmarek commented Sep 24, 2018

Hmm...odd. That snippet should work. ensure will always return a plain old synchronous event definition. And the debounceEvent util should work with any plain old synchronous event definition as seen in the type definitions:

function debounceEvent(
  msDelay: number,
  eventDef: EventDefinition
): EventDefinition {
 ...
}

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