Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to write lazy streams #10494

Merged
merged 3 commits into from
Feb 20, 2015
Merged

Make it easier to write lazy streams #10494

merged 3 commits into from
Feb 20, 2015

Conversation

wycats
Copy link
Member

@wycats wycats commented Feb 20, 2015

This PR incorporates stream-list.

This commit manages a lifecycle for streams. If a stream has no
subscribers, it is considered "inactive". When a stream gets
subscribers, it becomes "active".

A stream can register dependencies on other streams regardless of
whether the stream itself is active. When the stream becomes active, the
dependency will activate its subscriptions. When the stream becomes
inactive, the dependency will deactivate its subscriptions.

When a stream is destroyed, it automatically deactivates the
subscriptions of all dependencies.

This commit also add a new "revalidate" hook for streams, which gets
invoked when the valueFn is called, and right before a stream becomes
active. This hook can be used to tear down any state on the old value of
a dependent stream. For example, the KeyStream uses this hook to tear
down observers when the backing object for the stream has changed.

This commit manages a lifecycle for streams. If a stream has no
subscribers, it is considered "inactive". When a stream gets
subscribers, it becomes "active".

A stream can register dependencies on other streams regardless of
whether the stream itself is active. When the stream becomes active, the
dependency will activate its subscriptions. When the stream becomes
inactive, the dependency will deactivate its subscriptions.

When a stream is destroyed, it automatically deactivates the
subscriptions of all dependencies.

This commit also add a new "revalidate" hook for streams, which gets
invoked when the `valueFn` is called, and right before a stream becomes
active. This hook can be used to tear down any state on the old value of
a dependent stream. For example, the `KeyStream` uses this hook to tear
down observers when the backing object for the stream has changed.
@rwjblue
Copy link
Member

rwjblue commented Feb 20, 2015

@mmun - r?

@mmun
Copy link
Member

mmun commented Feb 20, 2015

r+

mmun added a commit that referenced this pull request Feb 20, 2015
Make it easier to write lazy streams
@mmun mmun merged commit 8714aba into master Feb 20, 2015
@mmun mmun deleted the lazy-stream branch February 20, 2015 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants