Files
ionic-framework/core/src/utils/status-tap.ts
2018-09-14 00:50:44 +02:00

21 lines
596 B
TypeScript

import { QueueApi } from '@stencil/core';
export function startStatusTap(win: Window, queue: QueueApi) {
win.addEventListener('statusTap', () => {
queue.read(() => {
const width = win.innerWidth;
const height = win.innerHeight;
const el = win.document.elementFromPoint(width / 2, height / 2) as (Element | null);
if (!el) {
return;
}
const contentEl = el.closest('ion-content');
if (contentEl) {
contentEl.componentOnReady().then(() => {
queue.write(() => contentEl.scrollToTop(300));
});
}
});
});
}