Harlock.Sub (harlock v0.2.0)

Copy Markdown View Source

Subscriptions — long-running sources of events that the runtime starts and stops as the model changes.

An app declares its active subscriptions via the optional subs/1 callback. The runtime diffs the returned list against what's currently running on each render: new entries get started, removed entries get stopped. The list is keyed by structural identity, so the same sub spec returned twice produces only one running process.

v0.1 provides Sub.interval/2. Richer kinds (pubsub, file watchers, signal handlers, websockets) arrive alongside the full Cmd executor.

Summary

Functions

Send msg to the runtime every ms milliseconds. The first fire happens after ms ms, not immediately.

Types

t()

@type t() :: {:interval, pos_integer(), any()}

Functions

interval(ms, msg)

@spec interval(pos_integer(), any()) :: t()

Send msg to the runtime every ms milliseconds. The first fire happens after ms ms, not immediately.