Created
August 7, 2017 21:13
-
-
Save miguelmota/e143c04980e3fcc1a0a359ea46284419 to your computer and use it in GitHub Desktop.
toastr wrapper
This file contains 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 options = { | |
progressBar: true, | |
preventDuplicates: true, | |
showEasing: `swing`, | |
hideEasing: `swing`, | |
showMethod: `fadeIn`, | |
hideMethod: `fadeOut`, | |
positionClass: `toast-top-center`, | |
closeButton: false, | |
timeOut: 5000, | |
extendedTimeOut: 1000, | |
}; | |
const genDummy = () => ({ | |
options: {}, | |
success: () => {}, | |
info: () => {}, | |
warning: () => {}, | |
error: () => {}, | |
remove: () => {}, | |
clear: () => {}, | |
}); | |
const toast = (window.toastr instanceof Object ? toastr : genDummy()); | |
toast.warn = toast.warning; | |
toastr.options = options; | |
export default toast; | |
export {toast}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment