Skip to content

Pulse ​

Application lifecycle state for TypeScript, React and React Native. One shared observation, immutable snapshots, and deduplicated foreground/background events.

Get started · Try the lifecycle lab · View on GitHub

Verification

The runtime and packaged consumer are tested automatically; physical-device and several browser lifecycle checks remain pending. See verification.

ts
import { Pulse } from "@priemskiyyy/pulse";
import { browser } from "@priemskiyyy/pulse/browser";

export const pulse = new Pulse({ adapter: browser() });

pulse.on("foreground", (event) => {
  console.log("Returned after", event.observedAway, "ms");
});
pulse.start();

One Pulse owns one observation of its host. It reports a phase and an interaction as frozen snapshots, and foreground and background transitions between known phases.

The guarantee, and where it ends ​

Given the same ordered observations, clock samples and listener operations, Pulse produces the same snapshots and the same transitions. It does not promise that the platform reports every physical change, reports it at once, or gives JavaScript time to finish anything. A snapshot is the latest usable evidence under a documented mapping; unknown means there is none.

It is not a scheduler, an exit hook, a presence tracker or a security signal; see what Pulse is not.

Where to go next ​

Released under the MIT License.