(arg1: any, arg2?: any)
| 99 | const SKIP_ANIMATION_CALL_LIMIT = 1024 |
| 100 | |
| 101 | const animate: any = (arg1: any, arg2?: any) => { |
| 102 | // Create the bail signal outside the returned promise, |
| 103 | // so the generated stack trace is relevant. |
| 104 | const bailSignal = new BailSignal() |
| 105 | const skipAnimationSignal = new SkipAnimationSignal() |
| 106 | |
| 107 | return (async () => { |
| 108 | bailIfEnded(bailSignal) |
| 109 | |
| 110 | const props: any = is.obj(arg1) ? { ...arg1 } : { ...arg2, to: arg1 } |
| 111 | props.parentId = callId |
| 112 | |
| 113 | eachProp(defaultProps, (value, key) => { |
| 114 | if (is.und(props[key])) { |
| 115 | props[key] = value |
| 116 | } |
| 117 | }) |
| 118 | |
| 119 | if (G.skipAnimation) { |
| 120 | if (++skipAnimationCallCount > SKIP_ANIMATION_CALL_LIMIT) { |
| 121 | stopAsync(state) |
| 122 | skipAnimationSignal.result = getFinishedResult(target, false) |
| 123 | bail(skipAnimationSignal) |
| 124 | throw skipAnimationSignal |
| 125 | } |
| 126 | |
| 127 | // Apply each step immediately so the script can run to completion |
| 128 | // and the spring lands on whatever value the final `next(...)` call |
| 129 | // would set under normal animation. |
| 130 | props.immediate = true |
| 131 | return await target.start(props) |
| 132 | } |
| 133 | |
| 134 | const result = await target.start(props) |
| 135 | bailIfEnded(bailSignal) |
| 136 | |
| 137 | if (state.paused) { |
| 138 | await new Promise<void>(resume => { |
| 139 | state.resumeQueue.add(resume) |
| 140 | }) |
| 141 | } |
| 142 | |
| 143 | return result |
| 144 | })() |
| 145 | } |
| 146 | |
| 147 | let result!: AnimationResult<T> |
| 148 |
no test coverage detected
searching dependent graphs…