Pike v8.1 release 6

Method Concurrent.Future()->then()


Method then

this_program then(void|function(mixed, mixed ... :mixed) onfulfilled, void|function(mixed, mixed ... :mixed) onrejected, mixed ... extra)

Parameter onfulfilled

Function to be called on fulfillment. The first argument will be the result of this Future. The return value will be the result of the new Future.

Parameter onrejected

Function to be called on failure. The first argument will be the failure result of this Future. The return value will be the failure result of the new Future.

Parameter extra

Any extra context needed for onfulfilled and onrejected. They will be provided as arguments two and onwards when the callbacks are called.

Returns

The new Future.

See also

thencatch() on_success(), Promise.success() on_failure(), Promise.failure() https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise