Rob--W / stackexchange-notifications

Realtime desktop notifications for Stack Exchange sites.
44 stars 8 forks source link

Preemptive feature detection for notifications #23

Closed kav2k closed 8 years ago

kav2k commented 8 years ago

Using the update probing trick, this removes cascaded try-catch from the main showNotification() code.

Rob--W commented 8 years ago

For future reference, "the update trick" is the thing that was introduced in e8f248954585bce042990b7102f4f166ff52b0a4, it works because chrome.notifications.update synchronously throws an error if the API is not supported, and that regardless of whether the notification exists, the API call is accepted. If the notification does not exist (we use notification ID ""), the callback (if provided) is called with the first parameter being false.

kav2k commented 8 years ago

Updated with suggestions.

Rob--W commented 8 years ago

Thanks for your work!