Skip to content

Guarantee future-turn resolutions #4

@jsor

Description

@jsor

At the moment, we're not guaranteeing future-turn resolutions (which basically means, that callbacks should always be called asynchronously, read this).

All major JavaScript libs guarantee that (when.js does not at the moment, but will in their next major release).

We have 2 options.

  1. We do not guarantee future-turn resolutions

    We keep it simple. Methods in When can stay static and creating Deferred's is as simple as doing $d = new Deferred. We should note that in the docs, so that developers are aware that there is no guarantee about if a promise will resolve asynchronously or synchronously.

  2. We do guarantee future-turn resolutions

    This would couple React/Promise to the EventLoop (or at least to some kind of QueueProcessor for which we have an EventLoop adapter). We would have to make When non-static (and require the EventLoop or a QueueProcessor in the constructor which will be passed to Deferredinstances) and it will most probably become some kind of global entry point for creating promises and deferreds.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions