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

Add JUMP_TO_STATE action for slider-like monitors #5

Merged
merged 1 commit into from
Jul 14, 2015

Conversation

gaearon
Copy link
Contributor

@gaearon gaearon commented Jul 14, 2015

I challenged you to implement slider-like custom monitors in #3, but in fact I forget something essential to make it easy.

The built-in LogMonitor lets you “toggle” individual actions, disabling them from history. This is not what slider interface is like though: a slider just moves back and forward in time between the computed state. It does not really alter the history: it only alters the current state we are looking at.

This PR adds another devtools action: JUMP_TO_STATE. By default, the currentStateIndex will advance any time an action is performed, but your custom monitor can also call this.props.jumpToState({ index: 0 }) to jump to the first state, or something in the middle (make sure to to put there values larger than this.props.computedStates.length - 1.

The default LogMonitor does not use this.props.jumpToState at all, but your custom monitor may use it, as well as this.props.currentStateIndex, to implement a slider-like UI.

gaearon added a commit that referenced this pull request Jul 14, 2015
Add JUMP_TO_STATE action for slider-like monitors
@gaearon gaearon merged commit ad55e25 into master Jul 14, 2015
@gaearon gaearon deleted the add-jump-to-state branch July 14, 2015 22:48
@gaearon gaearon mentioned this pull request Jul 14, 2015
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.

1 participant