io-toaster
Invent One
Based on Toastr package
Check it out at toastr
Quick Start
One Easy Step
For other API calls, see the toastr demo.
- import minified js and css files from dist/ directory
Basic Usage
node
; // OR const IOToaster = IOToaster;
browser
<!-- 1. Download library from gitlab repo 2. Unzip and copy dist folder into your project 3. link css and js files in dist/-->
Other Options
// Display an info toast with no titleIOToaster// Display a warning toast, with no titleIOToaster // Display a success toast, with a titleIOToaster // Display an error toast, with a titleIOToaster // Immediately remove current toasts without using animationIOToaster // Remove current toasts using animationIOToasterclear // Override global optionsIOToaster
Escape HTML characters
In case you want to escape HTML characters in title and message
IOToaster.options.escapeHtml = true;
Close Button
Optionally enable a close button
IOToasteroptionscloseButton = true;
Optionally override the close button's HTML.
IOToasteroptionscloseHtml = '<button><i class="icon-off"></i></button>';
You can also override the CSS/LESS for #toast-container .toast-close-button
Optionally override the hide animation when the close button is clicked (falls back to hide configuration).
IOToasteroptionscloseMethod = 'fadeOut';IOToasteroptionscloseDuration = 300;IOToasteroptionscloseEasing = 'swing';
Display Sequence
Show newest toast at bottom (top is default)
IOToasteroptionsnewestOnTop = false;
Callbacks
// Define a callback for when the toast is shown/hidden/clickedIOToasteroptions { console; }IOToasteroptions { console; }IOToasteroptions { console; }IOToasteroptions { console; }
Animation Options
IO Toaster will supply default animations, so you do not have to provide any of these settings. However you have the option to override the animations if you like.
Easings
Optionally override the animation easing to show or hide the toasts. Default is swing. swing and linear are built into jQuery.
IOToasteroptionsshowEasing = 'swing';IOToasteroptionshideEasing = 'linear';IOToasteroptionscloseEasing = 'linear';
Using the jQuery Easing plugin (http://www.gsgd.co.uk/sandbox/jquery/easing/)
IOToasteroptionsshowEasing = 'easeOutBounce';IOToasteroptionshideEasing = 'easeInBack';IOToasteroptionscloseEasing = 'easeInBack';
Animation Method
Use the jQuery show/hide method of your choice. These default to fadeIn/fadeOut. The methods fadeIn/fadeOut, slideDown/slideUp, and show/hide are built into jQuery.
IOToasteroptionsshowMethod = 'slideDown';IOToasteroptionshideMethod = 'slideUp';IOToasteroptionscloseMethod = 'slideUp';
Prevent Duplicates
Rather than having identical toasts stack, set the preventDuplicates property to true. Duplicates are matched to the previous toast based on their message content.
IOToasteroptionspreventDuplicates = true;
Timeouts
Control how IO Toaster interacts with users by setting timeouts appropriately. Timeouts can be disabled by setting them to 0.
IOToasteroptionstimeOut = 30; // How long the toast will display without user interactionIOToasteroptionsextendedTimeOut = 60; // How long the toast will display after a user hovers over it
Progress Bar
Visually indicate how long before a toast expires.
IOToasteroptionsprogressBar = true;
rtl
Flip the IO Toaster to be displayed properly for right-to-left languages.
IOToasteroptionsrtl = true;
Building IO Toaster
npm install -g gulp
npm install
At this point the dependencies have been installed and you can build IO Toaster
- Run the analytics
gulp analyze
- Run the build
gulp
Contributing
No contribution will be accepted on this project.
Authors
Invent One
Credits
Based on toastr
Copyright
Copyright © 2018