- From: Yoshisato Yanagisawa <notifications@github.com>
- Date: Wed, 21 May 2025 01:43:40 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/issues/1472/2897117405@github.com>
yoshisatoyanagisawa left a comment (w3c/ServiceWorker#1472) I am not sure either [PR](https://github.com/w3c/ServiceWorker/pull/1771) or here to reply, but let me reply here. As I mentioned in https://github.com/w3c/ServiceWorker/issues/1472#issuecomment-2840469985, update() returns the promise that will be resolved with `ServiceWorkerRegistration`. Let me explain one by one. This is the update() algorithm you might have already seen. https://w3c.github.io/ServiceWorker/#service-worker-registration-update In the algorithm, it creates `promise`, and the `promise` is passed to `CreateJob`. The returned `job` has the promise inside. https://w3c.github.io/ServiceWorker/#create-job Then the `job` will be passed to ScheduleJob https://w3c.github.io/ServiceWorker/#schedule-job RunJob will eventually be called. https://w3c.github.io/ServiceWorker/#run-job-algorithm Since this is Update, Update will eventually be called. https://w3c.github.io/ServiceWorker/#update Install will eventually be called if not promise rejected. https://w3c.github.io/ServiceWorker/#install In Step 7, [Resolve Job Promise](https://w3c.github.io/ServiceWorker/#resolve-job-promise) is called. In the algorithm, `job`'s promise will eventually be resolved by convertedValue, it is always be the return value of [the service worker registration object](https://w3c.github.io/ServiceWorker/#get-the-service-worker-registration-object), and you can see [ServiceWorkerRegistration](https://w3c.github.io/ServiceWorker/#serviceworkerregistration) is returned. Therefore, it is always be `ServiceWorkerRegistration` or rejected. Please feel free to ask questions if something not clear. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1472#issuecomment-2897117405 You are receiving this because you are subscribed to this thread. Message ID: <w3c/ServiceWorker/issues/1472/2897117405@github.com>
Received on Wednesday, 21 May 2025 08:43:44 UTC