Skip to content

Releases: asmsh/promise

v0.4.1

24 Dec 13:48
Compare
Choose a tag to compare

Fixes:

  • Added a check for a missing scenario for invalid usage of the resChan (sending 2 values concurrently).

Some breaking changes toward a more prod-ready behavior

29 Jan 18:19
Compare
Choose a tag to compare

BREAKING

  • Changed the behaviour of the Wait and GetRes methods to make them, when called on a promise, responsible for the UnCaughtErr panics and the non-recovered panics, instead of creating these panics from each promise's goroutine, which prevented these panics from being recovered in the calling goroutine.
  • Changed the behaviour of panicking for non-recovered promises to only happen in the Safe mode.
    So now, in the NonSafe mode, all calls will not panic when their promises' panic and are not recovered, in addition to already not panicking for un-caught errors(UnCaughtErr).
  • Changed the behaviour of the GetRes method to make it able to handle rejected promises and prevent UnCaughtErr panics, in the Safe mode.
  • Deprecated the GetErr and IsErrRes methods of the Res type, in preparation for their removal in the next minor release.
  • Removed the deprecated WaitUntil and GetResUntil methods from the Promise interface and the GoPromise implementation. The same functionality can be achieved using the chan returned from the WaitChan method, a time.Timer, and a select statement.
  • Changed the error message(the return of the Error method) of the UnCaughtErr type.

Improvements

  • Added new method to the Res type, Err, which replaces the deprecated methods GetErr and IsErrRes.

Other

  • Updated some of the docs.

v0.3.0

04 Dec 15:55
Compare
Choose a tag to compare

BREAKING

  • Changed the behaviour of passing 'nil' error value to the 'Reject' constructor to return a Fulfilled promise, instead of a Rejected one.
  • All constructors that accept a function will now panic if a 'nil' function is passed. The panic will now happen when passing the 'nil' function, instead of when calling it, and hence, the panic value is changed to be relative to this package.
  • Deprecated the 'WaitUntil' and the 'GetResUntil' methods, in preparation for their removal in the next minor release.

Improvements

  • Added a new constructor, 'Delay', which returns a promise that will be resolved to the provided 'Res' value after a delay.
  • Added a new method, 'Delay', to the 'Promise' interface and the 'GoPromise' implementation, which returns a promise that will be resolved to the same value after a delay.
  • Added a new type, 'Status', which represents the status of a single promise at the moment.
  • Added a new method, 'Status', to the 'Promise' interface and the 'GoPromise' implementation, which returns a value of type 'Status'.

Other

  • Updated some of the docs.
  • Added new test cases and benchmarks.
  • Added new example.

v0.2.0

11 Nov 22:25
Compare
Choose a tag to compare

Improvements

  • Added a new helper function, ReuseRes
  • Added new methods to the Res type: Copy, First, Clear, and IsZero
  • Updated the docs of the ImmutRes function
  • Other internal improvements

Other

  • Added new test cases and benchmarks
  • Updated some of the examples

Some fixes to the docs

29 Oct 19:22
Compare
Choose a tag to compare

Fixes:

  • Fixed the docs of the WaitUntil and the GetResUntil methods to describe their actual behavior(such that the passed duration is not the max wait duration, but the min wait duration)

v0.1.1

21 Oct 22:05
Compare
Choose a tag to compare

Fixes:

  • In the Resolver constructor, any panic that happens after the promise is resolved(after calling fulfill or reject), will not be recovered
  • For promises created from the New constructor, panic, as expected, if two or more values are sent on the channel, after the promise is Resolved

Improvements

  • Updated the docs
  • Other small internal improvements

Initial release

20 Oct 23:25
Compare
Choose a tag to compare
v0.1.0

Updated the README file