Added usage of the `then` call

This commit is contained in:
Tristan B. Velloza Kildaire 2023-02-22 16:57:00 +02:00
parent ac5c8dfcde
commit ea60097153
1 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,17 @@ Eventy eventy = new Eventy();
*/
Promise myPromise = eventy.new((x) => (x*2));
/**
* Chain a promise to this one such that upon completion of
* `myPromise` then `promise2` will run and `myPromise` will only
* be considered completely done once everything from its chain forward is
*
* NOTE: That a promise is only completed then once its chain forwards
* is completed
*/
Promise promise2 = eventy.new((x)=>());
myPromise.then(promise2);
/**
* Now start the promise and await its completion,
* this will basically sleep the calling thread