( overlay: OverlayInterface, animationBuilder: AnimationBuilder, baseEl: any, opts: any )
| 771 | }; |
| 772 | |
| 773 | const overlayAnimation = async ( |
| 774 | overlay: OverlayInterface, |
| 775 | animationBuilder: AnimationBuilder, |
| 776 | baseEl: any, |
| 777 | opts: any |
| 778 | ): Promise<boolean> => { |
| 779 | // Make overlay visible in case it's hidden |
| 780 | baseEl.classList.remove('overlay-hidden'); |
| 781 | |
| 782 | const aniRoot = overlay.el; |
| 783 | const animation = animationBuilder(aniRoot, opts); |
| 784 | |
| 785 | if (!overlay.animated || !config.getBoolean('animated', true)) { |
| 786 | animation.duration(0); |
| 787 | } |
| 788 | |
| 789 | if (overlay.keyboardClose) { |
| 790 | animation.beforeAddWrite(() => { |
| 791 | const activeElement = baseEl.ownerDocument!.activeElement as HTMLElement; |
| 792 | if (activeElement?.matches('input,ion-input, ion-textarea')) { |
| 793 | activeElement.blur(); |
| 794 | } |
| 795 | }); |
| 796 | } |
| 797 | |
| 798 | const activeAni = activeAnimations.get(overlay) || []; |
| 799 | activeAnimations.set(overlay, [...activeAni, animation]); |
| 800 | |
| 801 | await animation.play(); |
| 802 | |
| 803 | return true; |
| 804 | }; |
| 805 | |
| 806 | export const eventMethod = <T>(element: HTMLElement, eventName: string): Promise<T> => { |
| 807 | let resolve: (detail: T) => void; |
no test coverage detected