MicrosoftDocs / edge-developer

Developer documentation for Edge.
https://learn.microsoft.com/microsoft-edge/developer/
Creative Commons Attribution 4.0 International
381 stars 505 forks source link

[PWA widgets] Add documentation about options to update widgets more than once a day #3018

Open davesmits opened 7 months ago

davesmits commented 7 months ago

There are no noted restrictions about the update time. It kinda suggest the update time can be anything but everything below the values used in the doc (86.400) wont work


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

AB#48547685

captainbrosset commented 7 months ago

Thanks a lot for this issue. Can you say a little more about what happens when you choose a value that's less than 86400? What doesn't work exactly? Does the widget not get registered? Something else?

davesmits commented 7 months ago

@captainbrosset the docs inspired me to built a widget with PWA that shows your agenda from multiple accounts. The ease of using web technolgy and still be able to have full functionality was attractive.

Now I built the widget I learned service workers come with many limitations. The number of invocation of your serviceworker depend on the use of your app but will never be less then once a day (86400); using a update value like 3600 (every hour) will be still once a day, in best case, as many depends on your side engagement score which can be see here in edge: about://site-engagement/

Personally I think if your widget is depended on this, PWA doesnt make sense, Your widget needs to be useful (https://learn.microsoft.com/en-us/windows/apps/design/widgets/) and showing information that is 24 hours makes it useles for many cases

captainbrosset commented 7 months ago

Fair point. I'm going to discuss about this with the engineering team who knows best about service workers and widgets and we'll get back to you.

captainbrosset commented 7 months ago

Here are two options to update your widget:

Do these help?

davesmits commented 7 months ago

I am going to search about widgetresume. Thanks for the pointer!

Send push notifications isn't a option, well gives another challenge. Push Notification are required to use showNotification resuling in a toast banner. I see instagram doing it; but its annoying as hell. (https://web.dev/articles/push-notifications-handling-messages ) ; I am not reallt able to find any docs about edge specifics. So maybe edge is handling this different?

Alternative i was checking was to use WinAppSdk for a full native app and use WinRT background tasks which allows me to update each 15 minutes (https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.background.timetrigger.freshnesstime?view=winrt-22621)

But given de effort i Did moving to native is bit waste of time

davesmits commented 7 months ago

widget resume seems to work pretty nicely. Thanks!

captainbrosset commented 7 months ago

Push Notification are required to use showNotification resuling in a toast banner

Correct, silent push notifications are currently not supported by browsers, at least by Chrome and Edge.

widget resume seems to work pretty nicely. Thanks!

Oh great! Glad this is working for you. I'll add this issue to our backlog and use it to update the docs to mention how to update widgets more than once a day.