Last active
January 24, 2017 09:04
-
-
Save electerious/53c4f8015621790a46d5 to your computer and use it in GitHub Desktop.
Stop event propagation and prevent the default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stopEvent = (e = {}) => { | |
if (typeof e.stopPropagation==='function') e.stopPropagation() | |
if (typeof e.preventDefault==='function') e.preventDefault() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: