Enhanced offline (#249)

* Notification of updates & reloading

* Using version in service worker & allowing version to appear elsewhere

* Stupid file

* Ditching changelog for now. Using package json.

* Ugh.
This commit is contained in:
Jake Archibald
2018-11-09 09:13:14 -08:00
committed by GitHub
parent 6b76ea0a6f
commit 71f893cb44
11 changed files with 129 additions and 59 deletions

View File

@@ -12,6 +12,15 @@ import '../custom-els/LoadingSpinner';
// This is imported for TypeScript only. It isn't used.
import Compress from '../compress';
const compressPromise = import(
/* webpackChunkName: "main-app" */
'../compress',
);
const offlinerPromise = import(
/* webpackChunkName: "offliner" */
'../../lib/offliner',
);
export interface SourceImage {
file: File | Fileish;
data: ImageData;
@@ -36,16 +45,13 @@ export default class App extends Component<Props, State> {
constructor() {
super();
import(
/* webpackChunkName: "main-app" */
'../compress',
).then((module) => {
compressPromise.then((module) => {
this.setState({ Compress: module.default });
}).catch(() => {
this.showSnack('Failed to load app');
});
navigator.serviceWorker.register('../../sw');
offlinerPromise.then(({ offliner }) => offliner(this.showSnack));
// In development, persist application state across hot reloads:
if (process.env.NODE_ENV === 'development') {