mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Register a service worker.
This commit is contained in:
parent
e9323459ab
commit
20abbc3c16
@ -16,6 +16,7 @@
|
|||||||
<script src="{{ site.baseurl }}/assets/js/vendor/clipboard.min.js"></script>
|
<script src="{{ site.baseurl }}/assets/js/vendor/clipboard.min.js"></script>
|
||||||
<script src="{{ site.baseurl }}/assets/js/vendor/holder.min.js"></script>
|
<script src="{{ site.baseurl }}/assets/js/vendor/holder.min.js"></script>
|
||||||
<script src="{{ site.baseurl }}/assets/js/src/application.js"></script>
|
<script src="{{ site.baseurl }}/assets/js/src/application.js"></script>
|
||||||
|
<script src="{{ site.baseurl }}/assets/js/src/pwa.js"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script>
|
<script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script>
|
||||||
|
15
assets/js/src/pwa.js
Normal file
15
assets/js/src/pwa.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/* eslint no-console:off */
|
||||||
|
|
||||||
|
(function setupSW() {
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
window.addEventListener('load', function () {
|
||||||
|
navigator.serviceWorker.register('/sw.js').then(function (registration) {
|
||||||
|
console.log('ServiceWorker registration successful with scope: ', registration.scope)
|
||||||
|
}).catch(function (err) {
|
||||||
|
console.log('ServiceWorker registration failed: ', err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}())
|
@ -36,7 +36,7 @@
|
|||||||
"js-compile-bundle": "shx cat js/src/util.js js/src/alert.js js/src/button.js js/src/carousel.js js/src/collapse.js js/src/dropdown.js js/src/modal.js js/src/scrollspy.js js/src/tab.js js/src/tooltip.js js/src/popover.js | shx sed \"s/^(import|export).*//\" | babel --filename js/src/bootstrap.js | node build/stamp.js > dist/js/bootstrap.js",
|
"js-compile-bundle": "shx cat js/src/util.js js/src/alert.js js/src/button.js js/src/carousel.js js/src/collapse.js js/src/dropdown.js js/src/modal.js js/src/scrollspy.js js/src/tab.js js/src/tooltip.js js/src/popover.js | shx sed \"s/^(import|export).*//\" | babel --filename js/src/bootstrap.js | node build/stamp.js > dist/js/bootstrap.js",
|
||||||
"js-compile-plugins": "babel js/src/ --out-dir js/dist/ --source-maps",
|
"js-compile-plugins": "babel js/src/ --out-dir js/dist/ --source-maps",
|
||||||
"js-minify": "uglifyjs --config-file build/uglifyjs.config.json --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
|
"js-minify": "uglifyjs --config-file build/uglifyjs.config.json --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
|
||||||
"js-minify-docs": "uglifyjs --config-file build/uglifyjs.config.json --output assets/js/docs.min.js assets/js/vendor/anchor.min.js assets/js/vendor/clipboard.min.js assets/js/vendor/holder.min.js assets/js/src/application.js",
|
"js-minify-docs": "uglifyjs --config-file build/uglifyjs.config.json --output assets/js/docs.min.js assets/js/vendor/anchor.min.js assets/js/vendor/clipboard.min.js assets/js/vendor/holder.min.js assets/js/src/application.js assets/js/src/pwa.js",
|
||||||
"js-test": "phantomjs ./node_modules/qunit-phantomjs-runner/runner.js js/tests/index.html 60",
|
"js-test": "phantomjs ./node_modules/qunit-phantomjs-runner/runner.js js/tests/index.html 60",
|
||||||
"js-test-cloud": "ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd, :Logger => WEBrick::Log.new('/dev/null'), :AccessLog => []); trap('INT') { s.shutdown }; s.start\" & grunt saucelabs-qunit",
|
"js-test-cloud": "ruby -r webrick -e \"s = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => Dir.pwd, :Logger => WEBrick::Log.new('/dev/null'), :AccessLog => []); trap('INT') { s.shutdown }; s.start\" & grunt saucelabs-qunit",
|
||||||
"docs": "npm-run-all docs-compile docs-lint",
|
"docs": "npm-run-all docs-compile docs-lint",
|
||||||
|
Loading…
Reference in New Issue
Block a user