This adds support for queueing and resending Google Analytics pings while offline, via a new <platinum-sw-offline-analytics> element. The element itself is bare-bones, and effectively just imports a few existing helper libraries into the service worker: one to wrap IndexDB, and the other to deal with the Google Analytics queueing and replaying.
I've also wrapped some existing service worker helper libraries in an IIFE for cleanliness, and fixed a bug that I found with the way the parameters are serialized in <platinum-sw-register>.
I haven't put together tests for the new element. I'm at a loss for how to meaningfully simulate the full fail/queue/replay cycle, since all the code runs in the service worker.
R: @addyosmani @wibblymat
This adds support for queueing and resending Google Analytics pings while offline, via a new
<platinum-sw-offline-analytics>
element. The element itself is bare-bones, and effectively just imports a few existing helper libraries into the service worker: one to wrap IndexDB, and the other to deal with the Google Analytics queueing and replaying.I've also wrapped some existing service worker helper libraries in an IIFE for cleanliness, and fixed a bug that I found with the way the parameters are serialized in
<platinum-sw-register>
.I haven't put together tests for the new element. I'm at a loss for how to meaningfully simulate the full fail/queue/replay cycle, since all the code runs in the service worker.
The diff is cleanest to read with
w=1