Enode — API Reference
    Preparing search index...

    Function createLatestWins

    • Creates a runner that serializes "write the whole current state" tasks and keeps only the newest task submitted while another one is in flight.

      Returns LatestWinsRunner

      The run(task) function. Fire-and-forget: it returns nothing.

      • Idle: the task starts at once.
      • Busy: the task is parked; a later submission replaces the parked one. When the in-flight task settles (resolves OR rejects), the parked task starts — and the same rule applies while it runs.
      • A rejected task does not stop the chain: the parked (newer) task still runs, since it carries the state the user last saw. The runner itself swallows the rejection — a task must surface its own failure (present a toast, offer a retry), because fire-and-forget submission leaves no caller to hand the error to.