3 ms·
For an event that only happens once, then the navigator.serviceWorker.ready.then(function(){... version is preferable to document.addEventListener("s
by AgentME 12y ago
For an event that only happens once, then the
navigator.serviceWorker.ready.then(function(){...
version is preferable to
document.addEventListener("serviceready", function() {
because A) you don't have to worry about removing your event listener after the fact, and B) if the event has already happened, then your callback will be called immediately.