feature(status-tap): starting work on status tap, passing to Manu :-D

This commit is contained in:
Dan Bucholtz
2018-02-01 15:17:59 -06:00
parent 284dc584bc
commit 0a7d3808fd
2 changed files with 44 additions and 3 deletions

View File

@@ -34,9 +34,8 @@ export class Events {
}
@Listen('window:statusTap')
statusTap(_event: Event) {
// TODO - do status tap
return Promise.resolve();
statusTap(event: Event) {
return publishImpl(`app:${event.type}`, event);
}
}

View File

@@ -0,0 +1,42 @@
import { Component, Listen, Method, Prop } from '@stencil/core';
import { DomController } from '../..';
import { domControllerAsync } from '../../utils/helpers';
@Component({
tag: 'ion-status-tap'
})
export class StatusTap {
@Prop({ context: 'dom' }) dom: DomController;
@Listen('window:statusTap')
statusTap() {
handleTap(this);
}
@Method()
mockTap() {
return handleTap(this);
}
}
export function handleTap(tap: StatusTap): Promise<any> {
let width = 0;
let height = 0;
return domControllerAsync(tap.dom.read, () => {
width = window.innerWidth;
height = window.innerHeight;
}).then(() => {
const element = document.elementFromPoint(width / 2, height / 2);
if (!element) {
return;
}
const content = element.closest('.scroll-content');
if (!content) {
return;
}
throw new Error('Manu going to take over here');
});
}