question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Set max number of toasts

See original GitHub issue

First of all, THANK YOU! This is such an awesome little library. Compared to some of the other packages that implement toasts, your design around handling multiple toasts is sublime. Also, I love how easy it is to customize styling. I could go on.

I need to set a max number of toasts. Currently, I do it like this:

toast.subscribe((toasts) => {
    if (toasts.length > 5) {
        toasts.pop();
    }
});

But I don’t think that’s very nice. I’d rather there was something like a all or toasts attribute on toast, which gave a list of toasts so I could do something like:

if (toasts.all.length < 5) {
    toast.push(...)
}

I can of course also keep track of the number of toasts with a global variable, but this is not very nice I think.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zerodevxcommented, May 24, 2022

This should be fixed in v0.7.2.

0reactions
ulfaslakcommented, Jul 3, 2022

Awesome. Again, really enjoying your work. Thanks a lot!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] Option to set a Max number of toasts shown ...
This would just allow a certain number of toasts to show and if a new toast gets added then it would remove the...
Read more >
Rate limiting - - Developer guide - Toast APIs
A rate limit is a collection of limits. For example, 20 requests per second and 10,000 requests per fifteen minutes. Toast APIs return...
Read more >
Can an Android Toast be longer than Toast.LENGTH_LONG?
This means they are treated as flags rather than actual durations so I don't think it will be possible to set the duration...
Read more >
Toast | Android Developers
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. final Class<?> ......
Read more >
Device restart notifications - Configuration Manager
A Windows toast notification informs the user that the device needs to restart. ... The maximum value is 20160 minutes (two weeks).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found