description

# registerCallback<R> abstract method

ZoneCallback<R> registerCallback<R>(

1. R callback()

)

Registers the given callback in this zone.

When implementing an asynchronous primitive that uses callbacks, the callback must be registered using registerCallback at the point where the user provides the callback. This allows zones to record other information that they need at the same time, perhaps even wrapping the callback, so that the callback is prepared when it is later run in the same zones (using run). For example, a zone may decide to store the stack trace (at the time of the registration) with the callback.

Returns the callback that should be used in place of the provided `callback`. Frequently zones simply return the original callback.

Custom zones may intercept this operation. The default implementation in Zone.root returns the original callback unchanged.

## Implementation

    ZoneCallback<R> registerCallback<R>(R callback());