fix(app): listen statusTap event

This commit is contained in:
Manu Mtz.-Almeida
2018-08-25 10:18:32 +02:00
parent d4c812f5d2
commit dc82675ccb

View File

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