Skip to content

roblox-lua-promise v3.0.0

Compare
Choose a tag to compare
@evaera evaera released this 24 Aug 17:55
· 71 commits to master since this release

[3.0.0] - 2020-08-17

  • Promise.delay now uses os.clock
  • Made Promise.delay behavior more consistent when creating new timers in the callback of a timer.

[3.0.0-rc.3] - 2020-07-10

Fixed

  • Fixed a bug where queued andThen and catch callbacks did not begin on their own new threads.

[3.0.0-rc.1] - 2020-06-02

Changed

  • 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 Promise.new, andThen, and Promise.try executors.
  • Errors now have much better stack traces due to using xpcall internally instead of pcall.
  • 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.defer (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 "Timed out")
  • 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")
  • Let Promise:expect() throw rejection objects

Added

  • New Promise Error class is exposed at Promise.Error, which includes helpful static methods like Promise.Error.is.
  • Added Promise:now() (#23)
  • Added Promise.each (#21)
  • Added Promise.retry (#16)
  • Added Promise.fromEvent (#14)
  • Improved test coverage for asynchronous and time-driven functions

Fixed

  • Changed 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.)