ember-concurrency-decorators icon indicating copy to clipboard operation
ember-concurrency-decorators copied to clipboard

Add ability to specify multiple events

Open jamescdavis opened this issue 5 years ago • 2 comments
trafficstars

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

jamescdavis avatar Jul 14 '20 17:07 jamescdavis

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

chancancode avatar Jul 14 '20 18:07 chancancode

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

jamescdavis avatar Jul 14 '20 19:07 jamescdavis