pamoja for TypeScript - v0.2.0
    Preparing search index...

    Class Node

    A profile assembled around the parts that make it run: each tick reads, lets the profile's policy decide, switches the output when the policy calls for it, and publishes the reading to the profile's topic. run repeats that at the cadence the profile's power schedule sets for the battery's charge.

    Index
    • Assembles a node.

      Parameters

      • options: NodeOptions

        the profile, the reading, the link, and the output.

      Returns Node

      when the profile drives an output and no drive is given, or when its control kind is custom and no policy or registry decides it.

    profile: Profile

    The profile the node runs.

    • Ticks, then waits the interval the battery's charge calls for, until stopped.

      Parameters

      • options: RunOptions = {}

        when to stop, how to read the battery, and what to hear.

      Returns Promise<void>

      once the signal aborts or the ticks run out.

      the failure of a tick when no onError hears it.

    • Says what power mode the battery's charge puts the node in and how long to wait before the next tick. The node remembers the mode it chose, so a charge hovering at a threshold keeps the slower cadence until it clears the schedule's hysteresis.

      Parameters

      • charge: number

        the state of charge, from 0 to 1.

      • charging: boolean = false

        whether the panel is delivering charge.

      Returns { mode: PowerMode; waitMs: number }

      the mode, and the wait in milliseconds.

    • Runs one read, decide, act, and publish cycle.

      Returns Promise<Tick>

      the reading and what the policy decided about it.

      what the reading, the output, or the link throws.