(opts: TransitionOptions)
| 28 | * @returns A promise that resolves when the transition is complete. |
| 29 | */ |
| 30 | export const transition = (opts: TransitionOptions): Promise<TransitionResult> => { |
| 31 | return new Promise((resolve, reject) => { |
| 32 | writeTask(() => { |
| 33 | const transitioningInactiveHeader = getIosIonHeader(opts); |
| 34 | beforeTransition(opts, transitioningInactiveHeader); |
| 35 | runTransition(opts) |
| 36 | .then( |
| 37 | (result) => { |
| 38 | if (result.animation) { |
| 39 | result.animation.destroy(); |
| 40 | } |
| 41 | afterTransition(opts); |
| 42 | resolve(result); |
| 43 | }, |
| 44 | (error) => { |
| 45 | afterTransition(opts); |
| 46 | reject(error); |
| 47 | } |
| 48 | ) |
| 49 | .finally(() => { |
| 50 | // Ensure that the header is restored to its original state. |
| 51 | setHeaderTransitionClass(transitioningInactiveHeader, false); |
| 52 | }); |
| 53 | }); |
| 54 | }); |
| 55 | }; |
| 56 | |
| 57 | const beforeTransition = (opts: TransitionOptions, transitioningInactiveHeader: HTMLElement | null) => { |
| 58 | const enteringEl = opts.enteringEl; |
no test coverage detected