conductor
Why I'm building conductorGitHub
v1.5.0
v1.5.0
  • Introduction
  • Overview
    • Introduction
    • Core concepts
  • API reference
    • always
    • append
    • apply
    • arity
    • branch
    • capitalize
    • compose
    • concat
    • curry
    • curryN
    • delay
    • dump
    • entries
    • equals
    • equalsBy
    • factory
    • filter
    • findIndex
    • flatten
    • flip
    • forEach
    • get
    • head
    • ifElse
    • identity
    • into
    • isPromise
    • iterate
    • join
    • keys
    • map
    • merge
    • mergeBy
    • next
    • not
    • pluck
    • prepend
    • random
    • reduce
    • replace
    • slice
    • some
    • split
    • take
    • then
    • toLowerCase
    • transduce
    • transformers
      • transformers/filter
      • transformers/map
    • type
    • upsert
    • values
  • Guides
    • example use cases
    • checkGuards
Powered by GitBook
On this page
  • description
  • examples
  • basic example
  • partially applied form
  1. API reference

delay

delay :: (Number duration, Any value) => Promise<Any> output

description

Returns a Promise resolving to the output value (passed as the second argument) after the desired delay (passed as the first argument). It is particularly useful when it is used in its partially applied form in a composition chain.

examples

basic example

import { delay } from 'conductor'

await delay(1000, 'hello') // 'hello world'

partially applied form

import { compose, delay } from 'conductor'

const add1 = x => x + 1
await compose(delay(500), add1)(2) // 3
PreviouscurryNNextdump

Last updated 7 years ago