MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / startStatusTap

Function startStatusTap

core/src/utils/status-tap.ts:6–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { componentOnReady } from './helpers';
5
6export const startStatusTap = () => {
7 const win = window;
8 win.addEventListener('statusTap', () => {
9 readTask(() => {
10 const width = win.innerWidth;
11 const height = win.innerHeight;
12 const el = document.elementFromPoint(width / 2, height / 2) as Element | null;
13 if (!el) {
14 return;
15 }
16 const contentEl = findClosestIonContent(el);
17 if (contentEl) {
18 new Promise((resolve) => componentOnReady(contentEl, resolve)).then(() => {
19 writeTask(async () => {
20 /**
21 * If scrolling and user taps status bar,
22 * only calling scrollToTop is not enough
23 * as engines like WebKit will jump the
24 * scroll position back down and complete
25 * any in-progress momentum scrolling.
26 */
27 contentEl.style.setProperty('--overflow', 'hidden');
28
29 await scrollToTop(contentEl, 300);
30
31 contentEl.style.removeProperty('--overflow');
32 });
33 });
34 }
35 });
36 });
37};

Callers

nothing calls this directly

Calls 4

findClosestIonContentFunction · 0.90
componentOnReadyFunction · 0.90
scrollToTopFunction · 0.90
addEventListenerMethod · 0.65

Tested by

no test coverage detected