Skip to content

Commit

Permalink
flow: Event handlers, except .target
Browse files Browse the repository at this point in the history
  • Loading branch information
borisyankov committed Aug 12, 2018
1 parent 99069ff commit 114626a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/webview/js/js.js
Expand Up @@ -94,7 +94,7 @@ const getMessageNode = (node: Element): Element => {
return curNode;
};

const getMessageIdFromNode = (node: Node): number => {
const getMessageIdFromNode = (node: Element): number => {
const msgNode = getMessageNode(node);
return msgNode ? +msgNode.getAttribute('data-msg-id') : -1;
};
Expand Down Expand Up @@ -309,7 +309,7 @@ document.addEventListener('message', e => {
scrollEventsDisabled = false;
});

documentBody.addEventListener('click', e => {
documentBody.addEventListener('click', (e: any) => {
e.preventDefault();
lastTouchEventTimestamp = 0;

Expand Down Expand Up @@ -400,7 +400,7 @@ const handleLongPress = e => {
});
};

documentBody.addEventListener('touchstart', e => {
documentBody.addEventListener('touchstart', (e: TouchEvent) => {
if (e.changedTouches[0].pageX < 20) {
return;
}
Expand All @@ -411,7 +411,7 @@ documentBody.addEventListener('touchstart', e => {
setTimeout(() => handleLongPress(e), 500);
});

documentBody.addEventListener('touchend', e => {
documentBody.addEventListener('touchend', (e: TouchEvent) => {
if (
isNearPositions(
lastTouchPositionX,
Expand All @@ -424,11 +424,11 @@ documentBody.addEventListener('touchend', e => {
}
});

documentBody.addEventListener('touchmove', e => {
documentBody.addEventListener('touchmove', (e: TouchEvent) => {
lastTouchEventTimestamp = 0;
});

documentBody.addEventListener('drag', e => {
documentBody.addEventListener('drag', (e: DragEvent) => {
lastTouchEventTimestamp = 0;
});

Expand Down

0 comments on commit 114626a

Please sign in to comment.