Packages

o

dynamics.common

CallbackHelpers

object CallbackHelpers

Some small support to convert callback APIs in node to a cats effect. This is similar in spirit to io.scalajs.util.PromiseHelper. The first parameter is almost always a subtype of js.Error. Most of these methods check the value of the first parameter and if null or undefined, return a failed effect. The function argument is usually a curried function call from a javascript facade.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CallbackHelpers
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. def withError0[F[_], Z](f: (Function1[Z, Any]) ⇒ Unit)(implicit F: Async[F]): F[Unit]

    Pass in the function that you only care about the error handler value.

    Pass in the function that you only care about the error handler value. The 0 means that there are no arguments after the implied "error" first argument.

    Z

    Error type, typically js.Error.

    Annotations
    @inline()
  2. def withError1[F[_], Z, A](f: (Function2[Z, A, Any]) ⇒ Unit)(implicit F: Async[F]): F[A]

    Pass in the function that you only care about the error handler value and the value.

    Pass in the function that you only care about the error handler value and the value. The signature javascript callback signatre is usually (err, value). Use currying on the scala facade e.g. someFacadeFunc(arg1, (err, value) => ...) becomes withError1[IO,js.Error,Int](someFacadeFunc(arg1, _))..

    Z

    Error type, typically js.Error.

    A

    The value type.

    Annotations
    @inline()