Interface Callbacks


public interface Callbacks
A set of utilities for creating callbacks and promises using lambdas.
  • Method Details

    • promise

      static <S, T> elemental2.promise.Promise<S> promise(@Nullable HasEventHandling failHandler, Consumer<Callback<S,T>> t)
    • notNull

      static <S> elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFn notNull(@Nullable HasEventHandling failHandler, Consumer<S> realCallback, elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFn reject)
    • of

      static <S> Callback<S,String> of(@Nullable HasEventHandling failHandler, Consumer<S> from)
    • failLog

      static <S, F> void failLog(HasEventHandling failHandler, Consumer<S> from, F failure)
    • of

      static <S, F> Callback<S,F> of(BiConsumer<S,F> from)
      Transform a bi-consumer into a callback. It is the caller's responsibility to fire "requestfailed" events as appropriate.
    • grpcUnaryPromise

      static <S, F> elemental2.promise.Promise<S> grpcUnaryPromise(Consumer<JsBiConsumer<F,S>> t)
    • translateCallback

      static <S, F> void translateCallback(Callback<S,String> callback, Consumer<JsBiConsumer<F,S>> t)