Skip to content

Instantly share code, notes, and snippets.

@VinnyFonseca
Created September 12, 2019 11:52
Show Gist options
  • Save VinnyFonseca/1a63da1537be982ca6f0542f9f5613c9 to your computer and use it in GitHub Desktop.
Save VinnyFonseca/1a63da1537be982ca6f0542f9f5613c9 to your computer and use it in GitHub Desktop.
const wasTouched = () => {
myFrameworkOfChoice.dispatchEvent('USER_HAS_TOUCHED', true);
window.removeEventListener('touchstart', wasTouched, false);
window.addEventListener('mousedown', wasClicked, false);
};
const wasClicked = () => {
myFrameworkOfChoice.dispatchEvent('USER_HAS_TOUCHED', false);
window.removeEventListener('mousedown', wasClicked, false);
window.addEventListener('touchstart', wasTouched, false);
};
window.addEventListener('touchstart', wasTouched, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment