method Promise
1 | class Supply |
1.1 | (Supply) method Promise |
Documentation for method Promise
assembled from the following types:
class Supply
From Supply
(Supply) method Promise
method Promise(Supply: --> Promise)
Returns a Promise that will be kept when the Supply
is 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
The 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.