andrewMacmurray/elm-concurrent-task/1.1.0

NOTE: the latest version is 2.0.0

ConcurrentTask.Process

A drop in replacement for elm/core's Process.sleep.

The JavaScript runner has this task builtin by default. If needed it can be overridden like so:

NOTE: The custom example is the same as the built-in implementation.

import * as ConcurrentTask from "@andrewmacmurray/elm-concurrent-task"


ConcurrentTask.register({
  tasks: {},
  ports: app.ports,
  builtins: {
    sleep: customSleep
  }
});


function customSleep(ms: number): Promise<void> {
  return new Promise((resolve) => setTimeout(resolve, ms));
}
sleep : Int -> ConcurrentTask x ()

Wait for a number of milliseconds before continuing with the next Task.

A direct replacement for elm/core's Process.sleep.