Skip to content

Add blockUntilX functions #2

@JordanMartinez

Description

@JordanMartinez

A pattern I'm noticing in downstream Node libraries is something like this:

blockUntil1
  :: forall eventEmitter
   . eventEmitter 
  -> EventHandle eventEmitter (a -> Effect Unit) (EffectFn1 a Unit) 
  -> Aff Arg
blockUntil1 ee eventH = makeAff \done -> do
  removeListener <- ee # once eventH \arg ->
    done $ Right arg
  pure $ effectCanceler removeListener

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions