Method Concurrent.Future()->transform()


Method transform

this_program transform(function(ValueType, __unknown__ ... :mixed) success, function(mixed, __unknown__ ... :mixed)|void failure, mixed ... extra)

Description

This specifies callbacks that allow you to alter the future.

Parameter success

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

Parameter failure

Function to be called. The first argument will be the failure result of this Future. The return value will be the success result of the new Future. If this callback is omitted, it will default to the same callback as success.

Parameter extra

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

Returns

The new Future.

Note

This method is used if your callbacks return a regular value (i.e. not a Future).

See also

transform_with(), map(), recover()