ie-web-notifications / ie-web-notifications.github.io

IE Web Notifications (desktop notifications)
http://ie-web-notifications.github.io/
8 stars 2 forks source link

callback in requestPermission should be optional #13

Open Matthijs-Wessels opened 8 years ago

Matthijs-Wessels commented 8 years ago

Currently calling Notifcation.requestPermission() without specifying a callback will throw an error. This is a completely valid call (even when not considering the callback is deprecated). There are sites that don't specify any parameter here because they don't want to act immediately after the permission is granted.

This is happening for a site that I need to use and forces me to uninstall the plugin.

ie-web-notifications commented 8 years ago

Thanks for the report.

I will make it optional, however I'm not sure that it will really help. I guess the caller expects it to return some kind of thenable object but the return value is undefined, so it will fail trying to call then. IE (except Edge) does not have Promise, so I will try to find Promise property in window and if there is one use it as Promise and return Promise<NotificationPermission>. Let's see whether it works.

If it's possible could you please share the site where it happens?

Matthijs-Wessels commented 8 years ago

The application is Amazon WorkMail's web client. It's not free though, so you don't just have direct access to it to just try it out.

However, the way this app asks for permission is just when the application loads. It does not want to react to the response, so it doesn't provide a callback, nor calls then. So just making the callback optional will fix it for this app.

ie-web-notifications commented 8 years ago

Clear, thanks.

ie-web-notifications commented 8 years ago

Hi! I have made this parameter optional, please find it in the version v0.8. Just in case, so far it does not support Promises yet.