machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
690 stars 157 forks source link

Public TaskInstance and Task classes #123

Open janmisek opened 7 years ago

janmisek commented 7 years ago

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?

machty commented 7 years ago

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

janmisek commented 7 years ago

@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.

jerwilkins commented 6 years ago

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.