* Exit the frameloop and notify `onRest` listeners. * * Always wrap `_stop` calls with `batchedUpdates`.
(goal?: any, cancel?: boolean)
| 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. */ |
no test coverage detected