WikiEducationFoundation/WikiEduDashboard

View on GitHub
app/assets/javascripts/main.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
// This file gets added to the page via /app/views/shared/_head
// That Rails view also adds several JavaScript globals to the page,
// including the available locales and wikis, the Features enabled,
// and other static (from a JavaScript perspective) data objects.


// core-js/stable and regenerator-runtime/runtime are directly included to polyfill ES features and to use transpiled generator functions respectively, as @babel/polyfill is deprecated.
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import i18n from './i18n';

require('location-origin');
require('@rails/ujs').start(); // Enables rails-ujs, which adds JavaScript enhancement to some Rails views
window.List = require('list.js'); // List is used for sorting tables outside of React

document.addEventListener('DOMContentLoaded', () => {
  /* eslint-disable */
  import('./utils/course.js'); // This adds jquery features for some views outside of React
  
  // This is the main React entry point. It renders the navbar throughout the app, and
  // renders other components depending on the route.
  import('./components/app.jsx');
  import('events').then(({default: events}) => {
    events.EventEmitter.defaultMaxListeners = 30;
  });
    
});

i18n.defaultLocale = defaultLocale;
i18n.locale = locale;
i18n.availableLocales = availableLocales;
i18n.store(stores)
/* eslint-enable */