mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feature(status-tap): starting work on status tap, passing to Manu :-D
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
42
packages/core/src/components/status-tap/status-tap.tsx
Normal file
42
packages/core/src/components/status-tap/status-tap.tsx
Normal 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');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user