/
githubmirror
/
ionic-framework
Обзор
Документация
Войти
/
githubmirror
/
ionic-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
core/src/utils/status-tap.ts
37 строк
1 KB
Liam DeBeasi
fix(all): import path is now correct when using ionic in a stencil app (#25123)
14 апр 2022, 16:34
Не верифицирован
14 апр 2022, 16:34
1b407ab
Код
Авторство
О чём код?
import { readTask, writeTask } from '@stencil/core'; import { findClosestIonContent, scrollToTop } from './content'; import { componentOnReady } from './helpers'; export const startStatusTap = () => { const win = window; win.addEventListener('statusTap', () => { readTask(() => { const width = win.innerWidth; const height = win.innerHeight; const el = document.elementFromPoint(width / 2, height / 2) as Element | null; if (!el) { return; } const contentEl = findClosestIonContent(el); if (contentEl) { new Promise((resolve) => componentOnReady(contentEl, resolve)).then(() => { writeTask(async () => { /** * If scrolling and user taps status bar, * only calling scrollToTop is not enough * as engines like WebKit will jump the * scroll position back down and complete * any in-progress momentum scrolling. */ contentEl.style.setProperty('--overflow', 'hidden'); await scrollToTop(contentEl, 300); contentEl.style.removeProperty('--overflow'); }); }); } }); }); };