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

Allow toastr to refresh the timer on duplicates toasts when prevent defaults is on #209

Open
KamBha opened this issue Oct 5, 2016 · 0 comments

Comments

@KamBha
Copy link

KamBha commented Oct 5, 2016

I want to prevent defaults. However, the way that this works now is that if we prevent defaults we don't reset the timer. I thought I could make this work by doing the following:-

        var type = 'info'

        var toast = (toastr[type])(header, text, config);

        if (toast) {
            toast.open.promise.then(function thenRefreshTimer() {
                toastr.refreshTimer(toast);
            });
        }

However, this does not work as preventDuplicates does not retrieve the toast currently being used.

One way to solve this would be to manage my own list of toasters, but I would rather just have access to the list of toasters that is in the toastr service. I see a few solutions to my problem:-

  1. Have toastr. return the existing toaster
  2. Have a new option indicating what toastr should do with the duplicates (ie let them end as they do now or extend the timeout)
  3. Reveal the full list of open toasters in the toastr service and let me work out the toaster I am interested in.

I think (2) is probably the best solution, but (3) is probably more flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant