distinction between automatic closing and user action#104
distinction between automatic closing and user action#104zerodevx merged 2 commits intozerodevx:masterfrom
Conversation
|
Hey, continuing from #105, I understand the need to differentiate between dismiss by timeout, or user-action. It probably makes more sense to return a IMHO, the const { id, val } = await toast.push('hello world!')I'm been waiting (for a year now 😅) for Svelte's I'll probably merge this in first and refactor it to return a |
|
hi, I can change that to detail object in my pull request it that helps :) |
|
Great. Can you also run |
|
I've made changes and run |
|
That's ok - thanks so much for your contribution! |
|
Thank you. On the side note: maybe it's also a good time to update dependencies to newer versions? |
Yes I'm on it! 😄 |
|
Hey @dominikcz, hope you don't mind that I made some changes, mainly because I wanted to avoid polluting the toast.push('Hello world', {
onpop: (id, details) => {
// `details.event` contains the mouse or keyboard event
// and is `undefined` if the toast closes by timeout
}
}) |
|
Hi, I don't mind at all, |
HI, I have a case where I have to make a distinction between situations when user clicks a toast in order to close it and another one, when toast autocloses. That's why I propose additional (optional) parameter to onpop callback.
onpop: (id, ev) => {}When it autocloses ev is undefined. In other cases it is original event (mouse click, touch or key press).