---------- Forwarded message ---------
From: Hari krishna <
harry....@gmail.com>
Date: Wed, Sep 14, 2016, 4:43 PM
Subject: [chromium-discuss] serviceWorker continues running if there is self spawning message event
To: Chromium-discuss <
chromium...@chromium.org>
Hi there,
We have been playing around serviceWorker functionalities. What we did is, we created a message event handler, that spawns another message event for every minute.
Example code shown below.
self.addEventListener('message', function (event) {
var spawnNewMessageEvent = function (data) {
return new Promise(function (success) {
setTimeout(function () {
var sw = self.registration.active;
sw.postMessage(data);
success("success");
}, 30000)
});
};
event.waitUntil(doSomething().then(spawnNewMessageEvent));
});The above code snippet makes serviceWorker to keep running in the background. And we know that this is something message events shouldn't be used for. Just want to reach out the community, is it the intended behavior or kind of bug in serviceWorker? If it is intended behavior, it would be very helpful if you share the primary reason for developing this behavior (like some use cases or design decisions or tech debt)?
Thanks,
Hari krishna
--
--
Chromium Discussion mailing list:
chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss
---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
chromium-discu...@chromium.org.