1
1
import type { ComputedRef , MaybeRef , MaybeRefOrGetter , Ref } from 'vue'
2
+ import type { ConfigurableWindow } from '../_configurable'
2
3
import { identity as linear , promiseTimeout , tryOnScopeDispose } from '@vueuse/shared'
3
4
import { computed , ref as deepRef , toValue , watch } from 'vue'
5
+ import { defaultWindow } from '../_configurable'
4
6
5
7
/**
6
8
* Cubic bezier points
@@ -15,7 +17,7 @@ export type EasingFunction = (n: number) => number
15
17
/**
16
18
* Transition options
17
19
*/
18
- export interface TransitionOptions {
20
+ export interface TransitionOptions extends ConfigurableWindow {
19
21
20
22
/**
21
23
* Manually abort a transition
@@ -140,6 +142,9 @@ export function executeTransition<T extends number | number[]>(
140
142
to : MaybeRefOrGetter < T > ,
141
143
options : TransitionOptions = { } ,
142
144
) : PromiseLike < void > {
145
+ const {
146
+ window = defaultWindow ,
147
+ } = options
143
148
const fromVal = toValue ( from )
144
149
const toVal = toValue ( to )
145
150
const v1 = toVec ( fromVal )
@@ -175,7 +180,7 @@ export function executeTransition<T extends number | number[]>(
175
180
( source . value as number ) = arr [ 0 ]
176
181
177
182
if ( now < endAt ) {
178
- requestAnimationFrame ( tick )
183
+ window ?. requestAnimationFrame ( tick )
179
184
}
180
185
else {
181
186
source . value = toVal
0 commit comments