包详细信息

toastr2

JPeer2643.2kMIT3.0.0-alpha.18

ToastrJS is a JavaScript library for Gnome / Growl type non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be customized and extended.

Toastr, ToastrJS, toastr.js

自述文件

toastr2

Build Status Coverage Status

Note: this is a fork of toastr. This library is made to use it without jQuery and with Typescript

toastr is a Javascript library for non-blocking notifications The goal is to create a simple core library that can be customized and extended.

Demo

Install

npm

npm install toastr2

yarn

yarn add toastr2

Breaking Changes

Animation Changes

The following animations options have been deprecated and should be replaced:

  • Replace options.fadeIn with options.showDuration
  • Replace options.onFadeIn with options.onShown
  • Replace options.fadeOut with options.hideDuration
  • Replace options.onFadeOut with options.onHidden

Quick Start

2 Easy Steps

For other API calls, see the demo.

  1. Import toastr2 (js and css)

     import Toastr from 'toastr2';
    
     import 'toastr2/dist/toastr.min.css';
    
     const toastr = new Toastr();
  2. use toastr to display a toast for info, success, warning or error

     // Display an info toast with no title
     toastr.info('Are you the 6 fingered man?')

Other Options

// Display a warning toast, with no title
toastr.warning('My name is Inigo Montoya. You killed my father, prepare to die!')

// Display a success toast, with a title
toastr.success('Have fun storming the castle!', 'Miracle Max Says')

// Display an error toast, with a title
toastr.error('I do not think that word means what you think it means.', 'Inconceivable!')

// Immediately remove current toasts without using animation
toastr.remove()

// Remove current toasts using animation
toastr.clear()

// Override global options
toastr.success('We do have the Kapua suite available.', 'Turtle Bay Resort', {timeOut: 5000})

Escape HTML characters

In case you want to escape HTML characters in title and message

toastr.options.escapeHtml = true;

Close Button

Optionally enable a close button

toastr.options.closeButton = true;

Optionally override the close button's HTML.

toastr.options.closeHtml = '<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).

toastr.options.closeMethod = 'fadeOut';
toastr.options.closeDuration = 300;
toastr.options.closeEasing = 'swing';

Display Sequence

Show newest toast at bottom (top is default)

toastr.options.newestOnTop = false;

Callbacks

// Define a callback for when the toast is shown/hidden/clicked
toastr.options.onShown = () => console.log('hello');
toastr.options.onHidden = () => console.log('goodbye');
toastr.options.onclick = () => console.log('clicked');
toastr.options.onCloseClick = () => console.log('close button clicked');

Animation Options

Toastr 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.

toastr.options.showEasing = 'swing';
toastr.options.hideEasing = 'linear';
toastr.options.closeEasing = 'linear';

Using the jQuery Easing plugin (http://www.gsgd.co.uk/sandbox/jquery/easing/)

toastr.options.showEasing = 'easeOutBounce';
toastr.options.hideEasing = 'easeInBack';
toastr.options.closeEasing = '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.

toastr.options.showMethod = 'slideDown';
toastr.options.hideMethod = 'slideUp';
toastr.options.closeMethod = '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.

toastr.options.preventDuplicates = true;

Timeouts

Control how toastr interacts with users by setting timeouts appropriately.

toastr.options.timeOut = 30; // How long the toast will display without user interaction
toastr.options.extendedTimeOut = 60; // How long the toast will display after a user hovers over it

Prevent from Auto Hiding

To prevent toastr from closing based on the timeouts, set the timeOut and extendedTimeOut options to 0. The toastr will persist until selected.

toastr.options.timeOut = 0;
toastr.options.extendedTimeOut = 0;

Progress Bar

Visually indicate how long before a toast expires.

toastr.options.progressBar = true;

rtl

Flip the toastr to be displayed properly for right-to-left languages.

toastr.options.rtl = true;

Building Toastr

To build the minified and css versions of Toastr you will need node installed. (Use Homebrew or Chocolatey.)

npm install

At this point the dependencies have been installed and you can build Toastr

  • Run the analytics npm run lint
  • Run the test npm test
  • Run the build npm run build

Contributing

For a pull request to be considered it must resolve a bug, or add a feature which is beneficial to a large audience.

Pull requests must pass existing unit tests, CI processes, and add additional tests to indicate successful operation of a new feature, or the resolution of an identified bug.

Requests must be made against the develop branch. Pull requests submitted against the master branch will not be considered.

All pull requests are subject to approval by the repository owners, who have sole discretion over acceptance or denial.

Authors

John Papa

Tim Ferrell

Hans Fjällemark

Credits

Inspired by https://github.com/Srirangan/notifer.js/.

Copyright

Copyright © 2012-2015

License

toastr is under MIT license - http://www.opensource.org/licenses/mit-license.php

更新日志

3.0.0-alpha.18 - December, 10 2020

  • 49d351f Chore: revert to lowercase .css file | copy scss to dist for sourcemaps (JPeer264)

3.0.0-alpha.17 - December, 01 2020

  • e9b0b9e Chore: support case-sensitive platforms (JPeer264)

3.0.0-alpha.16 - December, 01 2020

  • 72a257f Chore: include src for npmignore for types and sourcemaps (JPeer264)

3.0.0-alpha.15 - April, 13 2020

  • 3915ff1 Docs: forgot ' in usage import (JPeer264)
  • bda5794 Chore: ignore more folders for npm to reduce download size (JPeer264)

3.0.0-alpha.14 - March, 18 2020

  • dc5d8f4 Test: add comment on skipped test (JPeer264)
  • 16a79e2 Test: add tests for remove and clear (JPeer264)
  • e4b3bba Test: add tests for debug (JPeer264)
  • e1c10ae Chore: update typings (JPeer264)
  • 34322dc Chore: update types for functions (JPeer264)
  • 3a82472 Chore: fix coverage (JPeer264)
  • 19956e0 Docs: remove cdns (JPeer264)
  • 3802d60 Chore: add coveralls and badges (JPeer264)
  • 177f1e2 Docs: update demo with npm script (JPeer264)

3.0.0-alpha.13 - March, 04 2020

  • 2be561f Fix license in package.json (#4) (Matthias Schiebel)
  • c37143d Chore: update node-sass for node v12 (JPeer264)
  • 97b8b72 Chore: update readme with new docs (JPeer264)
  • ae204c8 Chore: drop node v8 and use v10 and v12 (JPeer264)
  • 99a83bf Chore: use .flat shim for node v10 (JPeer264)

3.0.0-alpha.12 - February, 23 2020

  • 3e2bef0 Fix: add more cases with string[] to add classes (ref #3) (JPeer264)

3.0.0-alpha.11 - February, 22 2020

  • 0d66761 Test: remove old test setup files (JPeer264)
  • 34212fd Test: refactor positioning tests (JPeer264)
  • 2c24295 Test: refactor subscription and appearance (JPeer264)
  • 6c44622 Test: finish event refactoring (JPeer264)
  • 11dd222 Test: refactor more tests (JPeer264)
  • 92f4806 Style: if to better looking ternary operator (JPeer264)

3.0.0-alpha.10 - February, 21 2020

  • 082fbcc Chore: update github repo (JPeer264)
  • 4d387ab Docs: update badges in readme (JPeer264)
  • 1a4ee5b Chore: update jest and outsource config (JPeer264)
  • 4ec0ecf Chore: update husky and lint-staged (JPeer264)
  • 9e13188 Chore: different method of publishing (JPeer264)

3.0.0-alpha.9 - February, 21 2020

  • 6f025df Fix: add multiple classes divided by a space (closes #3) (JPeer264)

3.0.0-alpha.8 - February, 24 2019

  • c7ce7c2 Fix: wrong progressbar behavior (closes #1) (JPeer264)
  • c4883d9 Test: add more unit tests (JPeer264)

3.0.0-alpha.7 - February, 01 2019

  • 5ca4b4d Chore: remove rollup docstrings, add dynamic style build (JPeer264)
  • d9e426a Docs: update docs (JPeer264)
  • eee1ba0 Feat: make options public so they can be changed (JPeer264)
  • 295d4fa Style: remove one eslint error (JPeer264)
  • 051f26f Chore: move tests, update rollup (JPeer264)
  • a1f991f Test: add more tests (JPeer264)
  • c8d33f5 Test: finish refactoring clear tests (JPeer264)

3.0.0-alpha.6 - February, 01 2019

  • 6ad4726 Fix: optional types (JPeer264)

3.0.0-alpha.5 - February, 01 2019

  • 7658574 Chore: add root dir to jest (JPeer264)
  • 728b6af Chore: jest update testregex (JPeer264)
  • d180e21 Test: fix tests (JPeer264)
  • 432ebdf Chore: update rollup (JPeer264)
  • 4472a88 Chore: update travis (JPeer264)
  • c7c135b Test: outsource tests to have smaller test files (JPeer264)
  • e40b76c Test: add first two tests (JPeer264)
  • a482700 Chore: update test script (JPeer264)
  • a8a9b00 Test: add basic jest tests (JPeer264)
  • ce6e4a7 Chore: remove karma, prepare for jest (JPeer264)
  • 5f95f0d Chore: remove and clearup dependencies (JPeer264)
  • 2335d62 Chore: update little demo (JPeer264)
  • fbae88d Chore: remove jshint (JPeer264)
  • 7d51529 Refactor: remove nuget (JPeer264)

3.0.0-alpha.4 - January, 31 2019

  • 44ad8b2 Chore: remove next tag (JPeer264)
  • e364183 Docs: update readme (JPeer264)

3.0.0-alpha.3 - January, 31 2019

  • d95a7c1 ocs: update docs (JPeer264)
  • c0da425 Chore: update eslint dev dependencies (JPeer264)
  • 923fb90 Refactor: uppercase Toastr (JPeer264)
  • d11d136 Feat: export types (JPeer264)
  • 67158b7 Feat: Toastr. change to class (JPeer264)
  • f55780b Chore: add more types (JPeer264)

3.0.0-alpha.2 - January, 28 2019

  • e202935 Chore: change typings location (JPeer264)

3.0.0-alpha.1 - January, 28 2019

  • 6e5c230 Feat: add some types (JPeer264)

3.0.0-alpha.0 - January, 28 2019

  • 7e3fc00 Chore: update tets (JPeer264)
  • 0759723 Chore: change build to prepublish, works better with sgr (JPeer264)
  • db865b7 Chore: update build (JPeer264)
  • 8918efe Chore: update maintainer and package info (JPeer264)
  • f497b96 Feat: add eslint airbnb styleguide (JPeer264)
  • 21644bd Chore: change to typescript with no strict types (JPeer264)
  • 744b65c Refactor: remove jquery (JPeer264)
  • 50092cc Add yarn package manager to the list (#557) (iamfaizahmed123)
  • 5084952 add badges and add jsdelivr (#554) (Stephen)
  • aa1db85 added section for auto hiding (#576) (Marty Powell)
  • 2fac397 Create LICENSE (Tim Ferrell)
  • fc4ae18 Patching travis to use Node 6. (Timothy Ferrell)
  • 4bddf04 Manually merging in @JLHwung 's fork to resolve CI issues. (Timothy Ferrell)
  • 1ef00d7 Rev to 2.1.4. No changes except tag version. (Timothy Ferrell)
  • 4ba6bb3 Add link to Rails gem (Alex Kalinin)
  • 70dc5cf Fix headers in readme (Fernando van Loenhout)
  • 3efb7d9 Update README.md (Rainer Eli)
  • cdf2a6c CDN location changed (Alwin Kesler Pacheco)
  • 28fb8e4 Fix missing import. Remove unused dev dependencies. (ricardo.brandao)
  • 2601964 Adding tests for new aria functions. (Timothy Ferrell)
  • a13f418 Updating bug fix notes for 2.1.3 (Timothy Ferrell)
  • f6fb3e3 Updating version numbers. (Timothy Ferrell)
  • fd9d772 Updating release notes for the 2.1.3 release. (Timothy Ferrell)
  • 910b086 Removing unused functions and commented out code from the gulpfile. (Timothy Ferrell)
  • ea6a5ed Add tests to RTL support (Ricardo Brandão)
  • c43377c Add RTL support (closes #257 and closes #347) (Ricardo Brandão)
  • 4d5bab6 close button now has line-height 1 to stay consistent over bootstrap versions (pickledyamsman)
  • b99d6a8 Adding aria-live properties to the toast now that we've removed the role property. Success and info notifications will be 'polite', error and warning will be 'assertive'. #395 (Timothy Ferrell)
  • 50ff885 Removing role=alert to resolve #395. (Timothy Ferrell)
  • 9bfa655 Issue #407 - fixing IE opacity bug. Does not ultimately make any difference in the CSS, but yields some additional clarity. (Timothy Ferrell)
  • 060da57 Cleaning up karma formatting. Removing unused lines. (Timothy Ferrell)
  • 9ae6e41 Updating build artifacts. (Timothy Ferrell)
  • 3a45004 Resolving #420 targeting the wrong branch. (Timothy Ferrell)
  • 263577b Preserve margin-bottom of each toasts. (Wooram Jun)
  • b97bf66 Added new onCloseClick option, along with updated tests, README and demo page. (Ben Heymink)
  • 4a6e9f8 Add descendant div selector to hover (John Walker)
  • 50268fd Adding browser stack notice. (Tim Ferrell)
  • a17c960 Adding a closeOnHover option. Defaults to true for backward compatibility. Can be set to false to disable the feature that closes a toast when the toast is hovered upon (technically after a mouseout event). This came about because I needed a toast with a countdown, but didn't want the hover events to clear it. The current options didn't accommodate this use case. (John Sanders)
  • 335cf4f Add onclick to README's callback list (Tony Trinh)
  • d3e01ea fixed issue with screen reader duplicate announcements (Victor Carreno)
  • e64e7dc :v: (shashankanataraj)
  • f1f0faf :v: (shashankanataraj)
  • d4d6b49 Add class options for close button and progress (Jonathon Moore)
  • 709e189 clear delayed hide handlers - caused the issue to trigger the same hide response twice (Andreas Taube)
  • d1bfc46 Removed plato (shashankanataraj)
  • e72d504 Ticket #348 (Nicholas Deis)
  • 36a3ec1 Updated toastr.js (Andrew Stoker)
  • 9b7d1f1 Updating build info in toastr.js, and rebuilding. (Timothy Ferrell)
  • 9b8fe0b Wonder if VIM has a markdown preview... (Timothy Ferrell)
  • ec8bd45 Fixing up more merge. (Timothy Ferrell)
  • f341cb6 Merge. (Timothy Ferrell)
  • 76a485b Resolving README.md merge. (Timothy Ferrell)
  • ecf595d HTML escaping added (Sergey Zwezdin)
  • 141469a Removed the scheme from asset urls in the demo. (Shane Argo)
  • 503b5e0 Create default container opacity variable (iteam-software)
  • 17f4f9c Refactor for more clear intent (Jim Fitzpatrick)
  • b2e869a Generate CSS from less. (Rouven Weßling)
  • 1e18b98 Add new close animation options to README (Jim Fitzpatrick)
  • d276557 Add options to override close button animation (Jim Fitzpatrick)
  • 0fdcc90 Do not override margin-bottom (Dima Kurguzov)
  • c4fba38 Resolving jshint issues. (Timothy Ferrell)
  • 1c3f404 Pushing master commit back into develop (Tim Ferrell)
  • 3b5bc60 Update README.md (Dmitry Semigradsky)
  • e83b5d0 Updated docs for remove and clear (Cory House)
  • af8e7f4 Remove unused dependencies from package.json (Rouven Weßling)
  • ee045ab Adding example of global options override. (Timothy Ferrell)
  • 76e6928 Adding example of global options override. (Timothy Ferrell)
  • 945e3b8 Touching travis.yml file in master so that Travis CI picks up the change. (Timothy Ferrell)
  • 6131822 - Fixed issue in travis.yml (Stephen Bero)
  • a4b9796 - Added an ignore to travis for the v3 branch so that builds pass. (Stephen Bero)
  • dca0c5c Allow clicking through the toast container. (Jeff Hansen)
  • 658ecd3 Mention the ability to disable timeouts (Tomas Celaya)
  • bf1f038 Issue #261: Fixed an issue in the demo, where additional operations for the button delegates in the $(#showtoast).click function were triggering a console error. (Stephen Bero)
  • 79f5e12 Pass the event object on to onclick callback (James Tancock)
  • dec666c Updating demo to use bootstrap styling. (Timothy Ferrell)
  • 29d1f68 Updating CSS alpha filter (as in dev.) (Timothy Ferrell)
  • d94e2a7 Fix demo.html in develop branch. Same as #250. (robertd)
  • e1c68a5 Updating build. (Timothy Ferrell)
  • a235738 Updating output path for the sourcemaps. (Timothy Ferrell)
  • 0188795 Another copyright year update. (Timothy Ferrell)
  • d73edd6 Upticking the version number in the package.json (Timothy Ferrell)
  • 6430a55 Upticking the version number in the readme. (Timothy Ferrell)
  • d98178b Upticking the year. Adding btn style (Timothy Ferrell)
  • 7a46ee5 Removing unused tests. (Timothy Ferrell)
  • d9ac3a2 Resolving issue with prefixed slash on the map. (Timothy Ferrell)
  • 4a51cce Removing text added in error from the map file. (Timothy Ferrell)
  • 99971bd Updating source map location. (Timothy Ferrell)
  • b052e85 Updating source map reference. (Timothy Ferrell)
  • bf4d6dd added build files (John Papa)
  • d08193a tidied up code. up to 2.1.1 (John Papa)
  • b69e83d Renamed ignoreFocus to force (Jonas Stawski)
  • d4c246f remove clearExplicitly and replaced with clear($toast, options); (Jonas Stawski)
  • 5e10850 Added support for explicitly clearing a toast, which ignores the focus check (Jonas Stawski)
  • 707be4e Updating contrib wording. (Timothy Ferrell)
  • bce2952 Adding contribution guidelines. (Timothy Ferrell)
  • 4395be3 Updating minified build from latest pull requests. (Timothy Ferrell)
  • 09fdc6c adds tests for preventDuplicates override (vingiarrusso)
  • 7327259 Update notify to extend options with optionsOverride before checking for preventDuplicates. (Vinnie Giarrusso)
  • 1ee4502 Added type=button to close button. (Tudor Lupan)
  • a89bb7e Added additional test for preventDuplicates, allowing previous to be shown after cleared. (Stephen Bero)
  • aa18ba3 Adding source maps back. Rename was naming all files 'toastr.min.js'. (Timothy Ferrell)
  • 00941d1 Fix for preventDuplicates to allow the previous message to be shown after it disappears. (Stephen Bero)
  • 7875224 Change timeout to timeOut in readme (Frank LoVecchio)
  • 45d0909 removed src map reference (John Papa)
  • eed5829 removed src map for now and opened issue (John Papa)
  • c38dad6 readme fixes (John Papa)
  • 127a8c8 readme fixes (John Papa)
  • 2638cbd readme fixes (John Papa)
  • b90653d readme fixes (John Papa)
  • 911b9cc readme fixes (John Papa)
  • 577a90a fixed checklist (John Papa)
  • fa8dbbc comments, build, and lots of other garbage (John Papa)
  • 06843bb removed grunt (John Papa)
  • 1ea581b added a boatload of gulp stuff (John Papa)
  • 59718dc removed coverage form git (John Papa)
  • c96ec59 fixed gulp clean (John Papa)
  • a268de3 removed report folder. Oops! Thanks Tim (John Papa)
  • 1780037 converted to gulp. just tested analzye only (John Papa)
  • 482db00 Updating tag. (Timothy Ferrell)
  • 5cdebf1 Updating attribution on master readme. (Timothy Ferrell)
  • 75c3d71 Documenting preventDuplicates. (Timothy Ferrell)
  • dbe1f40 Making feature attribution clearer to better credit the authors. (Timothy Ferrell)
  • 491394a Minified JS file did not appear to be updated correctly in past pull requests. This minified file is cumulative. (Timothy Ferrell)
  • ba2899c Updating copyright information on js. (Timothy Ferrell)
  • 0988f8a Updating copyright information on stylesheets. (Timothy Ferrell)
  • a0e781f Updating the changelog to add progress bars and new date that is more reflective of actual release date. (Timothy Ferrell)
  • bbc63fe Illustrate how the progress bar functionality works in the readme. (Timothy Ferrell)
  • c4b7a41 Move progressBar variables to their own object for better readability (TravisTX)
  • 6b3d53b Fix whitespace (TravisTX)
  • fc3b0f8 Add unit tests for progress bar (TravisTX)
  • 55f6e6b Update scss file with latest css (TravisTX)
  • 13d27a6 Add progress bar (TravisTX)
  • 05fd5bd Update CHANGELOG.md (Tim Ferrell)
  • ac03fa8 Upping rev to align with newly merged pull requests. (Timothy Ferrell)
  • c156985 ADD unit tests (showwin)
  • 7a5adc7 ADD toast-bottom-center / UPDATE required files (showwin)
  • 4c96a3e Fix #182 (grassick)
  • 8dfe61b Add toast-top-center (showwin)
  • 8f61086 Update demo.html as issue 180. (Bartmax)
  • f9db605 updated readme, changelog and versions for upcoming 2.1.0 release (John Papa)
  • 843de38 Updating docs to show how timeouts work. (Timothy Ferrell)
  • 02e2d89 added real tests back (John Papa)
  • 4c4f4da karma setup for CI (John Papa)
  • e1b757e no bower (John Papa)
  • 65248b0 karma wants qunitjs peer dependency (John Papa)
  • b6658d0 caching node modules for travis (John Papa)
  • a2a3422 karma testing (John Papa)
  • c3e974b add travis image (John Papa)
  • 2f9afc1 Bump (Daniel Durante)
  • f9c3bbe Consistent naming conventions in comments (Connor Mullen)
  • 123ac44 Added unit tests for PR (Stephen Bero)
  • 12ba5c0 Update toastr.js (Stephen Bero)
  • bc2a276 Added the ability to prevent duplicate toasts from piling up using an extra option. (Stephen Bero)
  • e9f68ba toastr 2.0.3 nuget files (John Papa)
  • edf4f98 removed version from css (John Papa)
  • dd86ea3 2.0.3 (John Papa)
  • edf34eb Update demo.html (Seth Broweleit)
  • e29a0e3 Update CHANGELOG.md (John Papa)
  • 871c2a6 Closes #156. Refactored getContainer to only get the container, unless a 2nd boolean parameter is passed in in which case it will also create it if the container did not exist. (John Papa)
  • a0119a9 2.0.2 in links (John Papa)
  • 7b62d8a 2.0.2 nuget (John Papa)
  • ce7a7bd built 2.0.2 (John Papa)
  • 7c0a565 updated change log for 2.0.2 (John Papa)
  • 4ab8a44 updated release checklist for grunt (John Papa)
  • d3b1c12 updated version to 2.0.2 (John Papa)
  • dea7530 fixed bootstrap reference in demo (John Papa)
  • f64ae98 Added tests for #149 #118 (John Papa)
  • 3126a53 Clear all toasts followed by a new toast now shows the new toast. Fixes #149 #118 (John Papa)
  • 482cba7 missing comma (John Papa)
  • ad613b9 fixes onHidden firing twice when clicking on it then moving mouse out of it. closes #105 (John Papa)
  • 9e97de8 header text (John Papa)
  • b4c8b34 Added toastr.scss. This does not leverage any SASS benefits, a direct copy of the CSS. (Darren Haken)
  • 45c6362 added simple ARIA screen reader support (Greta Krafsig)
  • 9d7df36 Created change log (John Papa)
  • ea2f5db fixed media queries (John Papa)
  • 373805f Add Travis CI for PR testing (Nick Schonning)
  • ea7a5db Smushed with png gauntlet. (Drew Freyling)
  • 15a5126 smushed icon with pnggauntlet (Drew Freyling)
  • 2feae03 Adding back in support for browserify. (Stein Martin Hustad)
  • 6817025 restoring changes to CSS (ddotm)
  • 6989573 IE 8 does not support stopPropagation on the event. Using event.cancelBubble for IE 8 instead. (ddotm)
  • eca2136 fixed links. (Drew Freyling)
  • 1da4bd1 source map (John Papa)
  • e0ab24e wiki (John Papa)
  • 2432b3e Updated for v2.0.1 (John Papa)
  • a80710a Close button stopPropagation spelling fix. (Cesar Vargas)
  • efc5ad6 updated nuget (John Papa)
  • ad4f4bb Updated peripheral files for v2 (John Papa)
  • fcb3750 Updated to v2.0.0 (John Papa)
  • 02ed4d5 added release checklist (John Papa)
  • 7d08c6b added min files to bower.json (John Papa)
  • 2ff0855 Added jquery off CDN first, then bower, for unit tests (John Papa)
  • 9079adc Remove Close assertions (Nick Schonning)
  • 00f575a Add QUnit testing during Grunt build (Nick Schonning)
  • e5dee6b Add jQuery bower dependency (Nick Schonning)
  • 041f138 Pushed v2 rc1 changes to NuGet (John Papa)
  • a7d5d3e Closes #108. (John Papa)
  • fb34ff9 closes #35 closes $100 (John Papa)
  • 385c1b5 Refactored the code to be more readable. No functional changes. (John Papa)
  • 29fcfcb Updated for v 2.0.0rc1. ## Breaking Changes (John Papa)
  • d5d10b0 Edited responsive design, for the widths of toasts. (John Papa)
  • 801ad00 added fontawesome demo link (John Papa)
  • 4fca8df use grunt (http://gruntjs.com/) as a build system (Craig Teegarden)
  • 7836a22 fixed second link to demo (John Papa)
  • b422ad6 fixed demo link (John Papa)
  • 25be6f2 added CDN JS (John Papa)
  • 65e4731 updated bower to v1.3.1 (John Papa)
  • 7143a48 added package.json for cdnJS (John Papa)
  • a8e07ea 1.3.1 nuget spec files (John Papa)
  • 67ccbdb Explicitly name jQuery in Node require() call, so that browserify can detect the dependency (David McLean)
  • 23aad83 renamed component.json to bower.json (Stephen Willcock)
  • e65b543 updated version (John Papa)
  • 4475451 Fixed issue where if the first thing you do is clear, then you show multiple toasts, they all are stacked on top of each other. (John Papa)
  • 0dd76d4 updated toastr to include timings (John Papa)
  • 735a590 Addeed subscribe as a public API. Toastr now publishes when toasts are shown and hidden. (John Papa)
  • 6acd9ab Added bower info to readme (Stephen Willcock)
  • fd06541 Updated min file for v1.3.0 (John Papa)
  • 5d877c2 1.3.0 nuget packages (John Papa)
  • dd6635d Updating versions to 1.3.0 (John Papa)
  • b369a1e Added vendor prefixes for centering of toasts in full width view. Closes #70 (John Papa)
  • a672b31 . (John Papa)
  • c5fc142 Moved version umber to variable to make it easier to remember to update (John Papa)
  • cffdb1a Added border-box sizing for toastr elements. Closes #70 (hfjallemark)
  • da64cbd Option to show toasts in newestOnTop or not. (Jonas)
  • 4eb8f10 updated min file with full width changes (John Papa)
  • 35184ca Updated full width overrides (John Papa)
  • 41143c9 Fixed margins for full width css (John Papa)
  • e157827 Update toastr.js (John Papa)
  • 67dde98 To show the toasts in the opposite order. (Jonas)
  • cbcbf50 hmmmm (John Papa)
  • 9cbd72c added in file for js (John Papa)
  • 4f5c181 added semi colons to tests (John Papa)
  • 011c044 updated to version 1.2.3 (John Papa)
  • f7eb807 Fixed isue with internal mis-named global variable "container". Now local variable $container. (John Papa)
  • fd54292 Added toastr.less (John Reilly)
  • 0080c97 Adding options for events (Simon Grimshaw)
  • b62cb4e Add unit tests (Neil Stalker)

6454acf14 (2017-12-08)

No official release because there are only CI changes.

2.1.4 (2017-12-07)

  • Same as 2.1.3, except 2.1.4 is on NPM

2.1.3 (2016-07-22)

New Features

  • Right to left text support
  • Added callbacks for click events on close button

Bug Fixes

  • Fixed some CSS that prevented touch events from propagating on iOS devices
  • Removed role attribute because it duplicated voice over on text-to-speech readers; kept aria-live.
  • Consistent line-heights for close button to resolve issues with Bootstrap.

Dev Ops

  • Removed Plato from gulp

2.1.2 (2015-08-06)

New Features

  • Added HTML escaping (use toastr.options.escapeHTML)
  • Added more options for overriding animations, specifically to closing a toast
  • Events are now passed into the onClick handler of the toast

Bug Fixes

  • Resolved issue with centered toasts that would override top and bottom margins

Dev Ops

  • Removed module and require from the .jshintrc file
  • Cleaned up the readme
  • Builds moved to the builds folder
  • Made href calls relative to the transport in the demo
  • CSS is now built by the included LESS file as part of a gulp call
  • Removed un-used deps

2.1.1 (2015-02-19)

New Features

Dev Ops

  • Refactor to use gulp

2.1.0 (2014-10-15)

New Features

toastr.options.preventDuplicates = true;

toastr.options.progressBar = true;

Bug Fixes

  • None

Breaking Changes

  • None

Dev Ops

  • Add karma test runner
  • Added Travis CI hooks

2.0.3 (2014-05-17)

New Features

  • None

Bug Fixes

  • positionClass changes were not being honored due to 2.0.2 release changes. Refactored getContainer to only get the container, unless a 2nd boolean parameter is passed in in which case it will also create it if the container did not exist 871c2a6

Breaking Changes

  • None

2.0.2 (2014-04-29)

New Features

  • Added simple ARIA reader support (45c6362)
  • Added SASS support (direct port of CSS for now) (b4c8b34)

Bug Fixes

  • Added sourcemap for the min file (1da4bd1)
  • IE 8 does not support stopPropagation on the event (6989573)
  • Media query width fixes (ea2f5db)
  • Fix of onHidden firing twice when clicking on it then moving mouse out of toast (ad613b9 , #105)
  • Clear all toasts followed by a new toast now displays correctly (3126a53 , #149 , #118)

Breaking Changes

  • None

2.0.1 (2013-09-01)

New Features

Close Button

Optionally enable a close button

toastr.options.closeButton = true;

Optionally override the close button's HTML.

toastr.options.closeHtml = '<button><i class="icon-off"></i></button>';

You can also override the CSS/LESS for #toast-container .toast-close-button

Callbacks

// Define a callback for when the toast is shown/hidden
toastr.options.onShown = function() { console.log('hello'); }
toastr.options.onHidden = function() { console.log('goodbye'); }

Animation Options

Toastr 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.

toastr.options.showEasing = 'swing';
toastr.options.hideEasing = 'linear';

Using the jQuery Easing plugin (http://www.gsgd.co.uk/sandbox/jquery/easing/)

toastr.options.showEasing = 'easeOutBounce';
toastr.options.hideEasing = '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.

toastr.options.showMethod = 'slideDown'; 
toastr.options.hideMethod = 'slideUp'; 

Timeouts

Control how toastr interacts with users by setting timeouts appropriately.

toastr.options.timeout = 30; // How long the toast will display without user interaction
toastr.options.extendedTimeOut = 60; // How long the toast will display after a user hovers over it

Breaking Changes

Animation Changes

The following animations options have been deprecated and should be replaced:

  • Replace options.fadeIn with options.showDuration
  • Replace options.onFadeIn with options.onShown
  • Replace options.fadeOut with options.hideDuration
  • Replace options.onFadeOut with options.onHidden

Version 1.3.1

Display Sequence

Show newest toast at bottom (top is default)

toastr.options.newestOnTop = false;