Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Infinity for duration #124

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ If `gravity` is equals to `bottom`, it will be pushed from bottom.
|-----------------|----------------------|----------------------------------------------------------------------------|-------------|
| text | string | Message to be displayed in the toast | "Hi there!" |
| node | ELEMENT_NODE | Provide a node to be mounted inside the toast. `node` takes higher precedence over `text` | |
| duration | number | Duration for which the toast should be displayed.<br>-1 for permanent toast | 3000 |
| duration | number | Duration for which the toast should be displayed.<br>`-1` or `Infinity` for permanent toast | 3000 |
| selector | string \| ELEMENT_NODE | ShadowRoot | CSS Selector or Element Node on which the toast should be added | body |
| destination | URL string | URL to which the browser should be navigated on click of the toast | |
| newWindow | boolean | Decides whether the `destination` should be opened in a new window or not | false |
Expand Down
2 changes: 1 addition & 1 deletion src/toastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
}

// Clear timeout while toast is focused
if (this.options.stopOnFocus && this.options.duration > 0) {
if (this.options.stopOnFocus && this.options.duration > 0 && this.options.duration !== Infinity) {
var self = this;
// stop countdown
divElement.addEventListener(
Expand Down