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
Adding animation events to motion value #1826
Conversation
CHANGELOG.md
Outdated
### Added | ||
|
||
- `.on()` event method to `MotionValue`. | ||
- `"animationStart"`, `"animationComplete"`, and `"animationCancel"` events for `MotionValue`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about "change"
?
const value = motionValue(0) | ||
const callback = jest.fn() | ||
|
||
value.on("change", callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we keeping the old API around?
* @deprecated | ||
*/ | ||
onChange(subscription: Subscriber<V>): () => void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there's my answer 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha. I think it's so widely used by us I won't even throw in a warning
yet. I'm gonna drop it in the docs and then revisit in 6 months or so, maybe add a warning then.
4f9e17d
to
44debdd
Compare
b22d637
to
bc5c76a
Compare
Implements #1824
This PR adds a new event subscription method to motion values,
.on()
, along with three new motion value events,"animationStart"
,"animationComplete"
and"animationCancel"
.This allows multiple event handlers to be attached to the same motion value.