Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/piwik.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/js/piwik.js b/js/piwik.js
index 2014d9dc7f..272dd7324a 100644
--- a/js/piwik.js
+++ b/js/piwik.js
@@ -6855,6 +6855,13 @@ if (typeof window.Matomo !== 'object') {
// initialize the Matomo singleton
addEventListener(windowAlias, 'beforeunload', beforeUnloadHandler, false);
+ addEventListener(windowAlias, 'online', function () {
+ if (isDefined(navigatorAlias.serviceWorker) && isDefined(navigatorAlias.serviceWorker.ready)) {
+ navigatorAlias.serviceWorker.ready.then(function(swRegistration) {
+ return swRegistration.sync.register('matomoSync');
+ });
+ }
+ }, false);
addEventListener(windowAlias,'message', function(e) {
if (!e || !e.origin) {