mattermost-mobile/app/utils/tap.js
enahum c675b17e3c PLT-5840 Prevent double tapping (#464)
* PLT-5840 Prevent double tapping

* handle double tapping on channel header

* Review feedback
2017-04-09 22:43:18 -03:00

14 lines
374 B
JavaScript

// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
let canPress = true;
export function preventDoubleTap(action, thisArg, ...args) {
if (canPress) {
canPress = false;
Reflect.apply(action, thisArg || null, [...args]);
setTimeout(() => {
canPress = true;
}, 300);
}
}