Catspeak Reference


struct Future

function Future() constructor { 
  // 6 fields omitted
}
👎 Deprecated since 3.0.0

Constructs a new future, allowing for deferred execution of code depending on whether it was accepted or rejected.

§ accept

static accept = function(
  value? : Any,
)

Accepts this future with the supplied argument.

Arguments

  • value (optional)

    The value to reject.

§ andCatch

static andCatch = function(
  callback : Function,
) -> Struct.Future

Sets the callback function to invoke if an error occurrs whilst the process is running.

Arguments

  • callback

    The function to invoke.

Returns Struct.Future

§ andFinally

static andFinally = function(
  callback : Function,
) -> Struct.Future

Sets the callback function to invoke if this promise is resolved.

Arguments

  • callback

    The function to invoke.

Returns Struct.Future

§ andThen

static andThen = function(
  callback : Function,
) -> Struct.Future

Sets the callback function to invoke once the process is complete.

Arguments

  • callback

    The function to invoke.

Returns Struct.Future

§ reject

static reject = function(
  value? : Any,
)

Rejects this future with the supplied argument.

Arguments

  • value (optional)

    The value to reject.

§ resolved

static resolved = function()
  -> Bool

Returns whether this future has been resolved. A resolved future may be the result of being accepted OR rejected.

Returns Bool