[3.0.1] - 2020-08-24
Promise.is work with promises from old versions of the library (#41)
Promise.delay properly break out of the current loop (#40)
- Allow upvalues captured by queued callbacks to be garbage collected when the Promise resolves by deleting the queues when the Promise settles (#39)
[3.0.0] - 2020-08-17
Promise.delay now uses
Promise.delay behavior more consistent when creating new timers in the callback of a timer.
[3.0.0-rc.3] - 2020-07-10
- Fixed a bug where queued
catch callbacks did not begin on their own new threads.
[3.0.0-rc.1] - 2020-06-02
- Runtime errors are now represented by objects. You must call tostring on rejection values before assuming they are strings (this was always good practice, but is required now).
- Yielding is now allowed in
- Errors now have much better stack traces due to using
xpcall internally instead of
- Stack traces will now be more direct and not include as many internal calls within the Promise library.
- Chained promises from
resolve() or returning from andThen now have improved rejection messages for debugging.
Promise.async has been renamed to
Promise.async references same function for compatibility)
- Promises now have a
__tostring metamethod, which returns
Promise(Resolved) or whatever the current status is.
Promise:timeout() now rejects with a
Promise.Error(Promise.Error.Kind.TimedOut) object. (Formerly rejected with the string
- Attaching a handler to a cancelled Promise now rejects with a
Promise.Error(Promise.Error.Kind.AlreadyCancelled). (Formerly rejected with the string
"Promise is cancelled")
Promise:expect() throw rejection objects
- New Promise Error class is exposed at
Promise.Error, which includes helpful static methods like
- Improved test coverage for asynchronous and time-driven functions
Promise.is to be safe when dealing with tables that have an
__index metamethod that creates an error.
Promise.delay resolve value (time passed) is now more accurate (previously passed time based on when we started resuming threads instead of the current time. This is a very minor difference.)
- Fix issue with rejecting with non-string not propagating correctly.
- Add Promise.tap
- Fix bug with C functions not working when passed to andThen
- Fix issue with Promise.race/all always cancelling instead of only cancelling if the Promise has no other consumers
- Make error checking more robust across many methods.
- Promise.Status members are now strings instead of symbols, and indexing a non-existent value will error.
- Improve stack traces
- Promise.promisify will now turn errors into rejections even if they occur after a yield.
- Add Promise.try
Promise.race are now cancellable.
Promise.is now only checks if the object is "andThennable" (has an
- Make unhandled rejection warning trigger on next Heartbeat
Promise.spawn from the public API.
Promise.async still inherits the behavior from
Promise.async now wraps the callback in
pcall and rejects if an error occurred.
Promise.new has now has an explicit error message when attempting to yield inside of it.
Promise.promisify now uses
coroutine.wrap instead of
- Add Promise.race
- Add Promise.async
- Add Promise.spawn
- Add Promise.promisify
finally now silences the unhandled rejection warning
onCancel now returns if the Promise was cancelled at call time.
- Cancellation now propagates downstream.
resolve with a Promise while the resolving Promise is cancelled instantly cancels the passed Promise as an optimization.
finally now passes the Promise status as a parameter.