-
Notifications
You must be signed in to change notification settings - Fork 0
Task Modifiers #6
Comments
Thanks for creating this addon. We're currently using ember-concurrency-decorators so I'd prefer the concurrency-decorators style. It has the advantage, that the task definition is in one place, instead of being split by it's implementation. |
I don't mind doing this: @task({...})
someTask = task(function*() {...});
@restartableTask({...})
someOtherTask = task(function*() { ... }); I do like it for the reason, that at some point we will have this: @task({...})
someTask*() {...} The "the upper part" (= decorators) will mostly stay the same for what we write today and in the future, so no relearning here. While we (as TS users) know, that we cannot use I dunno how often syntax changed over the past 2-3 month. At least this sounds like an approach that will consistency. Although, yes - you may have a duplicate PS. I'm not clear about the current state of e-c and whether |
I'm generally a fan of I haven't looked at the implementation as it stands today, but do any of these approaches (putting aside decorators) allow for using augmentations that are made to the base |
@dfreeman The implicit limitation however is, that you can at most pass one argument and the argument itself cannot be This means a hypothetical extension like myTask = task({ throttle: [100, true] }, function*() {}); Writing this I just realized, that we actually need something like this, to support myTask = task({ on: ['init', 'click'] }, function*() {}); |
Unfortunately we cannot support task modifiers as easily as we planned initially in machty/ember-concurrency-decorators#50.
Our type definition currently basically looks like this:
The issue is that
task
returns aTask
, so that can callperform
etc. on the class property.However, this means that you can't call
.restartable()
etc. (fromTaskProperty
) in the class property assignment.I see the following solutions:
task
to return aTask & TaskInstance
, which loosens the type safety. 😦The text was updated successfully, but these errors were encountered: