feat(debug): Added PWA_APP_DEBUG_MODE
This commit is contained in:
@@ -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_BACKGROUND_COLOR = getattr(settings, 'PWA_APP_BACKGROUND_COLOR', '#fff')
|
||||||
PWA_APP_DISPLAY = getattr(settings, 'PWA_APP_DISPLAY', 'standalone')
|
PWA_APP_DISPLAY = getattr(settings, 'PWA_APP_DISPLAY', 'standalone')
|
||||||
PWA_APP_SCOPE = getattr(settings, 'PWA_APP_SCOPE', '/')
|
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_ORIENTATION = getattr(settings, 'PWA_APP_ORIENTATION', 'any')
|
||||||
PWA_APP_START_URL = getattr(settings, 'PWA_APP_START_URL', '/')
|
PWA_APP_START_URL = getattr(settings, 'PWA_APP_START_URL', '/')
|
||||||
PWA_APP_FETCH_URL = getattr(settings, 'PWA_APP_FETCH_URL', '/')
|
PWA_APP_FETCH_URL = getattr(settings, 'PWA_APP_FETCH_URL', '/')
|
||||||
|
|||||||
@@ -39,10 +39,14 @@
|
|||||||
scope: '{{ PWA_APP_SCOPE }}'
|
scope: '{{ PWA_APP_SCOPE }}'
|
||||||
}).then(function (registration) {
|
}).then(function (registration) {
|
||||||
// Registration was successful
|
// Registration was successful
|
||||||
|
{% if PWA_APP_DEBUG_MODE %}
|
||||||
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);
|
console.log('django-pwa: ServiceWorker registration successful with scope: ', registration.scope);
|
||||||
|
{% endif %}
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
// registration failed :(
|
// registration failed :(
|
||||||
|
{% if PWA_APP_DEBUG_MODE %}
|
||||||
console.log('django-pwa: ServiceWorker registration failed: ', err);
|
console.log('django-pwa: ServiceWorker registration failed: ', err);
|
||||||
|
{% endif %}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user