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

API Review: Periodic Background Sync and Background Sync API #4540

Open
wants to merge 17 commits into
base: api-periodic-sync-and-background-sync
Choose a base branch
from

Conversation

JosephJin0815
Copy link
Contributor

This is a review for the new Periodic Background Sync and Background Sync API.

@JosephJin0815 JosephJin0815 added the API Proposal Review WebView2 API Proposal for review. label May 7, 2024
@JosephJin0815 JosephJin0815 changed the title Add Periodic Background Sync and Background Sync API API Review: Periodic Background Sync and Background Sync API May 7, 2024
specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
auto webViewProfile3 = webView2Profile.try_query<ICoreWebView2Profile3>();
CHECK_FEATURE_RETURN_EMPTY(webViewProfile3);
wil::com_ptr<ICoreWebView2ServiceWorkerManager> serviceWorkerManager;
CHECK_FAILURE(webViewProfile3->get_ServiceWorkerManager(&serviceWorkerManager));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this API depends on the worker API. Do we need to wait for the worker API spec to finish first? Or will it be good to consider them at the same time?

}
else if (wcscmp(message.c_str(), L"GetPeriodicSyncRegistrations") == 0)
{
ShowAllSyncRegistrationInfos(COREWEBVIEW2_SERVICE_WORKER_SYNCHRONIZATION_KIND_PERIODIC_SYNC);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as previous about the scenario for the sample code. This looks like sandbox / playground sort of code to play with the API rather than sample code that demonstrates something an end dev would actually do with this API in their code.

specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
/// The minimum interval time, in milliseconds, at which the minimum time
/// interval between periodic background synchronizations should occur.
/// You should not call `CoreWebView2ServiceWorkerSyncRegistrationManager.DispatchPeriodicSyncEventAsync`
/// to dispatch periodic synchronization tasks less than its minimum time interval.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you say in here why we end devs shouldn't do this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we said in chat that you would add something like 'This is because the periodic sync web APIs standard says it will not be dispatched more often than the minimum time interval and the web content may not handle the event being raised more often.'

specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
specs/PeriodicBackgoundSyncAndBackgroundSync.md Outdated Show resolved Hide resolved
/// The minimum interval time, in milliseconds, at which the minimum time
/// interval between periodic background synchronizations should occur.
/// You should not call `CoreWebView2ServiceWorkerSyncRegistrationManager.DispatchPeriodicSyncEventAsync`
/// to dispatch periodic synchronization tasks less than its minimum time interval.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we said in chat that you would add something like 'This is because the periodic sync web APIs standard says it will not be dispatched more often than the minimum time interval and the web content may not handle the event being raised more often.'


event Windows.Foundation.TypedEventHandler<CoreWebView2ServiceWorkerSyncRegistrationManager, CoreWebView2ServiceWorkerSyncRegisteredEventArgs> PeriodicSyncRegistered;

Windows.Foundation.IAsyncOperation<IVectorView<CoreWebView2ServiceWorkerSyncRegistrationInfo>> GetSyncRegistrationsAsync(CoreWebView2ServiceWorkerSynchronizationKind Kind);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already two events for background and periodic seems like it would make sense to also have two separate methods to get background and periodic registrations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Proposal Review WebView2 API Proposal for review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants