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 ability to specify multiple events #78

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

Conversation

jamescdavis
Copy link
Contributor

@jamescdavis jamescdavis commented Jul 14, 2020

The .on() and .cancelOn() task modifiers are variadic, accepting a list of trigger events. Currently, ember-concurrency-decorators only allows specifying a single event, e.g

@task({ on: 'start', cancelOn: 'stop' })

This PR retains that API and adds the ability to specify multiple events as an array:

@task({ on: 'start', cancelOn: 'stop' }) // existing API is retained

@task({ on: ['start', 'go'], cancelOn: ['stop', 'bye'] }) // can now specify multiple events

@task({ on: ['start'], cancelOn: ['stop'] }) // also valid

I have updated the types to only accept an array if the modifier method accepts more than one parameter:

@task({ drop: [true] }) // type error
@task({ maxConcurrency: [1] }) // type error
@task({ group: ['foo'] }) // type error

@chancancode @maxfierke @dfreeman @chriskrycho

@chancancode
Copy link
Contributor

Are there runtime tests for this repo at all? If so, do we need to update those as well?

@jamescdavis jamescdavis force-pushed the add_ability_to_specify_multiple_events branch from fc73935 to 529fdc0 Compare July 14, 2020 19:16
@jamescdavis
Copy link
Contributor Author

jamescdavis commented Jul 14, 2020

@chancancode there are some basic runtime tests, but they are very incomplete. I'm not sure why CI is failing. Tests are passing locally.

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.

None yet

2 participants