feat(debug): Added PWA_APP_DEBUG_MODE

This commit is contained in:
Silvio Leite
2019-12-08 18:00:40 -03:00
parent 1e71602bfe
commit 595c258ca0
2 changed files with 5 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ PWA_APP_THEME_COLOR = getattr(settings, 'PWA_APP_THEME_COLOR', '#000')
PWA_APP_BACKGROUND_COLOR = getattr(settings, 'PWA_APP_BACKGROUND_COLOR', '#fff')
PWA_APP_DISPLAY = getattr(settings, 'PWA_APP_DISPLAY', 'standalone')
PWA_APP_SCOPE = getattr(settings, 'PWA_APP_SCOPE', '/')
PWA_APP_DEBUG_MODE = getattr(settings, 'PWA_APP_DEBUG_MODE', True)
PWA_APP_ORIENTATION = getattr(settings, 'PWA_APP_ORIENTATION', 'any')
PWA_APP_START_URL = getattr(settings, 'PWA_APP_START_URL', '/')
PWA_APP_FETCH_URL = getattr(settings, 'PWA_APP_FETCH_URL', '/')

View File

@@ -39,10 +39,14 @@
scope: '{{ PWA_APP_SCOPE }}'
}).then(function (registration) {
// Registration was successful
{% if PWA_APP_DEBUG_MODE %}
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);
{% endif %}
}, function (err) {
// registration failed :(
{% if PWA_APP_DEBUG_MODE %}
console.log('django-pwa: ServiceWorker registration failed: ', err);
{% endif %}
});
}
</script>