index.js 684 B

123456789101112131415161718192021222324
  1. // Polyfills, primarily for testing in IE11
  2. require('es6-promise/auto')
  3. require('whatwg-fetch')
  4. const DragDrop = require('./DragDrop.js')
  5. const Dashboard = require('./Dashboard.js')
  6. switch (window.location.pathname.toLowerCase()) {
  7. case '/':
  8. case '/dashboard.html': Dashboard(); break
  9. case '/dragdrop.html': DragDrop(); break
  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. }