Skip to content

Commit

Permalink
Disable service worker for Carlo. Closes #164
Browse files Browse the repository at this point in the history
  • Loading branch information
roosmaa committed Jan 3, 2019
1 parent 64da1a6 commit 3d89d17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as config from './config.json';
import App from './containers/App';
import registerServiceWorker from './registerServiceWorker';
import * as serviceWorker from './registerServiceWorker';
import * as routes from './routes';
import { TConfig, TStores } from './stores';
import RootStore from './stores/root';
Expand All @@ -31,4 +31,10 @@ const root = (
);

ReactDOM.render(root, document.getElementById('root') as HTMLElement);
registerServiceWorker(store);

const isDesktop = typeof carlo !== undefined;
if (!isDesktop) {
serviceWorker.register(store);
} else {
serviceWorker.unregister();
}
2 changes: 1 addition & 1 deletion src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const isLocalhost = Boolean(
)
);

export default function register(store: RootStore) {
export function register(store: RootStore) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
Expand Down

0 comments on commit 3d89d17

Please sign in to comment.