Plushie.Runtime.Subscriptions (Plushie v0.7.1)

Copy Markdown View Source

Subscription lifecycle management for the Plushie runtime.

Compares the app's current subscribe/1 output against the active subscriptions, starting new ones and stopping removed ones. Timer-based subscriptions (:every) are managed locally; renderer-based subscriptions (:on_key_press, etc.) are forwarded to the bridge.

Summary

Functions

Synchronizes subscriptions with the app's current subscribe/1 output.

Functions

sync_subscriptions(state, new_model, extra_specs \\ [])

@spec sync_subscriptions(map(), term(), [Plushie.Subscription.t()]) :: map()

Synchronizes subscriptions with the app's current subscribe/1 output.

Stops subscriptions that are no longer in the spec list, starts new ones, and preserves unchanged ones. Returns the updated state.