What are yieldables in co?
masterA yieldable is any object that co can process when it is yielded inside a generator. co supports the following yieldables:
- Promises: Standard JavaScript promises.
- Thunks: Functions that take a single argument (a callback). Note: Thunk support is for backwards compatibility and may be removed.
- Arrays: Yielding an array resolves all yieldables within it in parallel.
- Objects: Yielding an object resolves all yieldables within it in parallel.
- Generators / Generator Functions: Used for delegation (though moving towards spec-compliant Promises is recommended).
Nested yieldables are supported (e.g., an array containing objects containing promises).