lime
lime copied to clipboard
Add standard convenience functions for creating Promises to resolve groups of Futures.
trafficstars
Several convenience functions which mostly mimic promise handling functionality from JavaScript. Definitely standard enough to be part of the base library.
Promises.all()resolves an array of Futures, completing when all of the Promises are fulfilled or any of the Promises are rejected.Promises.allSettled()resolves an array of Futures, completing when all of the Promises are fulfilled or rejected.Promises.any()resolves an array of Futures, completing when any of the Promises is fulfilled or all of the Promises are rejected.Promises.race()resolves an array of Futures, completing when any of the Promises is fulfilled or rejected.
Good example use cases include calling lime.utils.Assets.loadImage() for each of an Array of images; you now have multiple promises, and want to wait for all of them to resolve before continuing.