Skip to content

Commit

Permalink
WIP: js.js
Browse files Browse the repository at this point in the history
  • Loading branch information
borisyankov committed Sep 16, 2018
1 parent 9647df4 commit 5a475d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/webview/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ documentBody.addEventListener('click', (e: any) => {
}
});

const handleLongPress = e => {
const handleLongPress = (e: TouchEvent) => {
// The logic that defines a "long press" in terms of raw touch events
// is pretty subtle. The `lastTouchEventTimestamp` and surrounding logic
// are an attempt to define a long press.
Expand All @@ -393,11 +393,13 @@ const handleLongPress = e => {

lastTouchEventTimestamp = 0;

if (e.target instanceof Element) {
sendMessage({
type: 'longPress',
target: e.target.matches('.header') ? 'header' : 'message',
messageId: getMessageIdFromNode(e.target),
});
}
};

documentBody.addEventListener('touchstart', (e: TouchEvent) => {
Expand Down

0 comments on commit 5a475d7

Please sign in to comment.