chandlerprall / insula

State management library for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support computed state

chandlerprall opened this issue · comments

Use case

  1. sharing computed state - the Current Episode in a playlist is computed from a list of episodes and a timestamp, and is a useful thing to compute once and share
  2. reacting to the proper state change - A media element emits the current playhead at least 4 times a second. Reacting to this in the listener can result in repeated expensive computations. Instead, a Current Episode  derived/computed state could be listened to directly, limiting reactive computation only to times when the value has changed.

This will need to maintain a dependency tree between computed values to avoid creating infinite update loops.

#10 is PR for computed state