MCPcopy
hub / github.com/pmndrs/react-spring / _stop

Method _stop

packages/core/src/SpringValue.ts:1023–1052  ·  view source on GitHub ↗

* Exit the frameloop and notify `onRest` listeners. * * Always wrap `_stop` calls with `batchedUpdates`.

(goal?: any, cancel?: boolean)

Source from the content-addressed store, hash-verified

1021 * Always wrap `_stop` calls with `batchedUpdates`.
1022 */
1023 protected _stop(goal?: any, cancel?: boolean) {
1024 if (isAnimating(this)) {
1025 setActiveBit(this, false)
1026
1027 const anim = this.animation
1028 each(anim.values, node => {
1029 node.done = true
1030 })
1031
1032 // These active handlers must be reset to undefined or else
1033 // they could be called while idle. But keep them defined
1034 // when the goal value is dynamic.
1035 if (anim.toValues) {
1036 anim.onChange = anim.onPause = anim.onResume = undefined
1037 }
1038
1039 callFluidObservers(this, {
1040 type: 'idle',
1041 parent: this,
1042 })
1043
1044 const result = cancel
1045 ? getCancelledResult(this.get())
1046 : getFinishedResult(this.get(), checkFinished(this, goal ?? anim.to))
1047
1048 flushCalls(this._pendingCalls, result)
1049 anim.changed = false
1050 sendEvent(this, 'onRest', result, this)
1051 }
1052 }
1053}
1054
1055/** Returns true when the current value and goal value are equal. */

Callers 5

advanceMethod · 0.95
setMethod · 0.95
finishMethod · 0.95
stopMethod · 0.95
_mergeMethod · 0.95

Calls 10

isAnimatingFunction · 0.90
setActiveBitFunction · 0.90
eachFunction · 0.90
callFluidObserversFunction · 0.90
getCancelledResultFunction · 0.90
getFinishedResultFunction · 0.90
flushCallsFunction · 0.90
checkFinishedFunction · 0.85
sendEventFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected