chore: avoid creating object for performance upgrade (#14776)

This commit is contained in:
pavelmash 2019-04-10 10:02:48 +03:00 committed by iamkun
parent f06ef4d82d
commit 88b628bd04

View File

@ -6,7 +6,7 @@ export default {
let startTime;
const handler = () => vnode.context[binding.expression].apply();
const clear = () => {
if (new Date() - startTime < 100) {
if (Date.now() - startTime < 100) {
handler();
}
clearInterval(interval);
@ -15,7 +15,7 @@ export default {
on(el, 'mousedown', (e) => {
if (e.button !== 0) return;
startTime = new Date();
startTime = Date.now();
once(document, 'mouseup', clear);
clearInterval(interval);
interval = setInterval(handler, 100);