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

Public TaskInstance and Task classes

Open janmisek opened this issue 8 years ago • 3 comments

Hello I need to check whether variable is instance of Task or TaskInstance but these are not public.

Currently I am accessing classes from private namespace, but its sort hacky.

import {Task} from 'ember-concurrency/-task-property';
import {TaskInstance} from 'ember-concurrency/-task-instance';

Is there a possibility to make them public or did I miss something?

janmisek avatar Feb 24 '17 13:02 janmisek

@janmisek Just out of curiosity, what's the use case for checking this?

machty avatar Feb 24 '17 14:02 machty

@machty I have altered Ember route model resolving using tasks. My augmentation is based on following article. https://engineering.linkedin.com/blog/2016/12/ember-concurrency--or--how-i-learned-to-stop-worrying-and-love-t

I did some universal solution and I want to do some assertions for developers convenience. This is our local solution until routable components arrives in Ember.

janmisek avatar Feb 24 '17 15:02 janmisek

I also have a use case for this: My generic search component is supplied a search task by its consumers (which in turn is called in an action using perform), and I'd rather check that the supplied search task is an instance of Task than guess based on the presence or absence of a perform method.

jerwilkins avatar May 03 '18 21:05 jerwilkins