mirror of
https://github.com/captbaritone/webamp
synced 2024-11-22 16:20:49 +00:00
[PWA] (2/2) Add service worker
This commit is contained in:
parent
ea9bc832b3
commit
a277a72f57
@ -1,6 +1,7 @@
|
||||
const webpack = require("webpack");
|
||||
const merge = require("webpack-merge");
|
||||
const common = require("./webpack.common.js");
|
||||
const workboxPlugin = require("workbox-webpack-plugin");
|
||||
|
||||
const config = merge(common, {
|
||||
devtool: "source-map",
|
||||
@ -15,6 +16,11 @@ const config = merge(common, {
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
sourceMap: true
|
||||
}),
|
||||
new workboxPlugin.GenerateSW({
|
||||
swDest: "service-worker.js",
|
||||
clientsClaim: true,
|
||||
skipWaiting: true,
|
||||
})
|
||||
]
|
||||
});
|
||||
|
@ -43,6 +43,15 @@
|
||||
<meta name="msapplication-TileImage" content="<%= require('./images/manifest/icon-144x144.png') %>">
|
||||
<meta name="msapplication-TileColor" content="#4b4b4b">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
|
||||
<!-- Load and register service worker that adds offline support -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('/service-worker.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
16
package.json
16
package.json
@ -13,17 +13,20 @@
|
||||
"test": "jest --coverage",
|
||||
"travis-tests": "jest --coverage && npm run lint && npm run build",
|
||||
"tdd": "jest --watch",
|
||||
"format":
|
||||
"prettier --write experiments/**/*.js js/**/*.js css/**/*.css webpack.config.js webpack.production.config.js",
|
||||
"build-skin":
|
||||
"rm skins/base-2.91.wsz && cd skins/base-2.91 && zip -x .* -x 'Skining Updates.txt' -r ../base-2.91.wsz .",
|
||||
"format": "prettier --write experiments/**/*.js js/**/*.js css/**/*.css webpack.config.js webpack.production.config.js",
|
||||
"build-skin": "rm skins/base-2.91.wsz && cd skins/base-2.91 && zip -x .* -x 'Skining Updates.txt' -r ../base-2.91.wsz .",
|
||||
"skin-info": "unzip -vl skins/base-2.91.wsz"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/captbaritone/winamp2-js.git"
|
||||
},
|
||||
"keywords": ["Winamp", "HTML5", "audio", "web-audio-api"],
|
||||
"keywords": [
|
||||
"Winamp",
|
||||
"HTML5",
|
||||
"audio",
|
||||
"web-audio-api"
|
||||
],
|
||||
"author": "Jordan Eldredge <jordan@jordaneldredge.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -53,7 +56,8 @@
|
||||
"style-loader": "^0.19.1",
|
||||
"travis-weigh-in": "^1.0.2",
|
||||
"url-loader": "^0.6.2",
|
||||
"webpack-dev-server": "^2.7.1"
|
||||
"webpack-dev-server": "^2.7.1",
|
||||
"workbox-webpack-plugin": "^3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel": "^6.23.0",
|
||||
|
Loading…
Reference in New Issue
Block a user