Fork me on GitHub

VanillaToasts

Agnostic Javascript Library for Website Notifications

Create Toast



Documentation


Installing


Using NPM


  $ npm install vanillatoasts

  var VanillaToasts = require('vanillatoasts');
          

Using Bower


  $ bower install vanillatoasts

  <script src="/bower_components/vanillatoasts/VanillaToasts.js"></script>
          

Do not forget to include the CSS file on your site!


  <link rel="stylesheet" href="/bower_components/vanillatoasts/vanillatoasts.css">
          

Usage



VanillaToasts.create({
  title: 'Welcome to my site',
  text: 'This toast will hide after 5000ms or when you click it',
  type: 'warning', // success, info, warning, error   / optional parameter
  icon: '/img/alert-icon.jpg', // optional parameter
  timeout: 5000 // hide after 5000ms, // optional paremter
  callback: function() { ... } // executed when toast is clicked / optional parameter
});