Package 

Class CallbackProducer

    • Method Summary

      Modifier and Type Method Description
      Boolean getHasCallback()
      Unit set(THandler handler) Set the callback.
      final Unit fire(Function1<THandler, Unit> callback) Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists.
      final Unit fireOnMain(Function1<THandler, Unit> callback) Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists.
      final Unit suspendingFire(SuspendFunction1<THandler, Unit> callback) Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists.
      final Unit suspendingFireOnMain(SuspendFunction1<THandler, Unit> callback) Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CallbackProducer

        CallbackProducer()
    • Method Detail

      • set

         Unit set(THandler handler)

        Set the callback.

        Parameters:
        handler - The handler that will be called when required.
      • fire

         final Unit fire(Function1<THandler, Unit> callback)

        Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists. It is done this way to avoid this abstract class from knowing the specific signature of the handler.

        Parameters:
        callback - The callback will be invoked if one exists, allowing you to call the handler.
      • fireOnMain

         final Unit fireOnMain(Function1<THandler, Unit> callback)

        Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists. It is done this way to avoid this abstract class from knowing the specific signature of the handler. The callback will be invoked asynchronously on the main thread. Control will be returned immediately, most likely prior to the callbacks being invoked.

        Parameters:
        callback - The callback will be invoked if one exists, allowing you to call the handler.
      • suspendingFire

         final Unit suspendingFire(SuspendFunction1<THandler, Unit> callback)

        Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists. It is done this way to avoid this abstract class from knowing the specific signature of the handler.

        Parameters:
        callback - The callback will be invoked if one exists, allowing you to call the handler.
      • suspendingFireOnMain

         final Unit suspendingFireOnMain(SuspendFunction1<THandler, Unit> callback)

        Call this to fire the callback which will allow the caller to drive the calling of the callback handler if one exists. It is done this way to avoid this abstract class from knowing the specific signature of the handler. The callback will be invoked on the main thread.

        Parameters:
        callback - The callback will be invoked if one exists, allowing you to call the handler.