whatwg / notifications

Notifications API Standard
https://notifications.spec.whatwg.org/
Other
137 stars 49 forks source link

Add progress based notifications #17

Open keithamus opened 10 years ago

keithamus commented 10 years ago

Abstract

It would be useful to have progress based notifications, that allow you to indicate the current progress of a long running task.

Justification

Aside from the usefulness of telling a user that a task is in progress, Android devices in particular already have this feature natively:

Proposal

I propose having a read only property on the notification called "progress". It expects a floating point value between 0 and 1.

Creating a new notification with the same tag as a previous notification, but a different progress float gives the UA an opportunity to display a progress bar for this notification. Other UAs will not be effected, and will gracefully continue doing what they do.

Example

# Contrived progress example, but could be done with Streams based on current/total.
var progress = 0.1;
setTimeout(function updateProgress() {
    progress += 0.1;
    if (progress < 1) {
        new Notification('Downloading...', {
            body: 'Downloading file.zip',
            progress: 0.1,
            tag:'download/file.zip'
        });
        setTimeout(updateProgress, 500);
    }
}, 500);
annevk commented 10 years ago

Thanks @keithamus. Might take a while before we get to this. Paging @sicking @hober @beverloo

sicking commented 10 years ago

Yes, we definitely need this!

beverloo commented 10 years ago

I definitely agree that this is a good extension. I'm in favor of richer notifications in general, e.g. buttons and lists.

sicking commented 10 years ago

We aimed for a different approach with regards to lists, but in the end I think doing a list might be simpler.

With regards to notifications that ask for input, through buttons or even text fields, this also seems like an interesting area, but feels more complex. Especially since I don't think the spec is good yet at handling sending back notifications to the opening page/app if the opening page/app has been closed since the notification was created.

/ Jonas