index.js 703 B

123456789101112131415161718192021222324
  1. // eslint-disable-next-line import/no-extraneous-dependencies
  2. import 'uppy/src/style.scss'
  3. import DragDrop from './DragDrop.js'
  4. import Dashboard from './Dashboard.js'
  5. switch (window.location.pathname.toLowerCase()) {
  6. case '/':
  7. case '/dashboard.html': Dashboard(); break
  8. case '/dragdrop.html': DragDrop(); break
  9. default: throw new Error('404')
  10. }
  11. if ('serviceWorker' in navigator) {
  12. // eslint-disable-next-line compat/compat
  13. navigator.serviceWorker
  14. .register('/sw.js')
  15. .then((registration) => {
  16. console.log('ServiceWorker registration successful with scope: ', registration.scope)
  17. })
  18. .catch((error) => {
  19. console.log(`Registration failed with ${error}`)
  20. })
  21. }