Created
January 30, 2021 02:44
-
-
Save songjiz/4ab5348fa16581f20471f18624558022 to your computer and use it in GitHub Desktop.
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
export default class extends ApplicationController { | |
print() { | |
window.print() | |
} | |
scrollToTop() { | |
window.scrollTo({ top: 0, behavior: "smooth" }) | |
} | |
confirm(event) { | |
const { message } = event.target.closest("[data-message]").dataset | |
const result = window.confirm(message) | |
if (!result) event.preventDefault() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment