Skip to content

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