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

On notification subtitle show time elapsed since notification shown #33

Open
slimninja opened this issue Nov 26, 2020 · 2 comments
Open

Comments

@slimninja
Copy link

slimninja commented Nov 26, 2020

On creation of toast, set date-created attribute to Date.now() and then have a recursive timeout to update the subtitle. On notification dismiss, destroy the chain.

Dirty non-working example:

function updateToastStatus(toast) {
    var data = toast.data();
    startTime = data.created
    // logic to update subtitle to show now, 5 seconds ago, 10 min ago, etc
    setTimeout(updateToastStatus, 5000);
}

updateToastStatus(toast); // First call starts process

image

Planning on taking care of this at some point, I'll update here if I do.

@Script47
Copy link
Owner

How would this affect those toasts which already have a subtitle?

@slimninja
Copy link
Author

Id keep this as a seperate option on toast definition, as it would have some performance impact based on number of toasts you're creating.

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

2 participants