Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created August 7, 2017 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save miguelmota/e143c04980e3fcc1a0a359ea46284419 to your computer and use it in GitHub Desktop.
Save miguelmota/e143c04980e3fcc1a0a359ea46284419 to your computer and use it in GitHub Desktop.
toastr wrapper
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