Documentation for method Promise, assembled from the following types:
method Promise(Supply: --> Promise)
Returns a Promise that will be kept when the
done. If the
Supply also emits any values, then the
Promise will be kept with the final value. Otherwise, it will be kept with
Nil. If the
Supply ends with a
quit instead of a
done, then the
Promise will be broken with that exception.
my = Supplier.new;my = .Supply;my = .Promise;.then(-> );.emit('cha'); # not output yet.done(); # got cha
Promise method is most useful when dealing with supplies that will tend to produce just one value, when only the final value is of interest, or when only completion (successful or not) is relevant.