Tostr - simple JavaScript toast norifications
source link: https://www.tuicool.com/articles/ENBbMja
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
tostr
Simple toast notifications for JavaScript
Usage
createToast
createToast function takes 4 parameters:
- Message: the text you want displayed in the toast message
- Type: what type of message this is; types available are SUCCESS, ERROR, WARNING
- Position: where the message should be positioned at; available positions are TOP, BOTTOM, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
- Lifespan: the lifespan of the message given in milliseconds;
Example usage
createToast("Example toast notification", SUCCESS, BOTTOM_LEFT, 3000);
- this creates a toast notification in the bottom left corner with the status of success that will be displayed for 3 seconds before disapearing
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK