Phyks (Lucas Verney)
fffe9c4cd3
Major code review, cleaning the code and adding a lot of comments. Also implements a separate store to keep entities with a reference count and garbage collection. This closes #15. Known issues at the moment are: * Webplayer is no longer working, it has to be refactored. * AlbumPage is to be implemented.
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
/**
|
|
* This is the main JS entry point in development build.
|
|
*/
|
|
import React from "react";
|
|
import ReactDOM from "react-dom";
|
|
|
|
// Load react-a11y for accessibility overview
|
|
var a11y = require("react-a11y");
|
|
a11y(React, { ReactDOM: ReactDOM, includeSrcNode: true });
|
|
|
|
// Load common index
|
|
const index = require("./index.all.js");
|
|
|
|
// Initial rendering function from common index
|
|
var render = index.onWindowIntl();
|
|
if (module.hot) {
|
|
// If we support hot reloading of components,
|
|
// display an overlay for runtime errors
|
|
const renderApp = render;
|
|
const renderError = (error) => {
|
|
const RedBox = require("redbox-react").default;
|
|
ReactDOM.render(
|
|
<RedBox error={error} />,
|
|
index.rootElement
|
|
);
|
|
};
|
|
|
|
// Try to render, and display an overlay for runtime errors
|
|
render = () => {
|
|
try {
|
|
renderApp();
|
|
} catch (error) {
|
|
console.error(error);
|
|
renderError(error);
|
|
}
|
|
};
|
|
|
|
module.hot.accept("./app/containers/Root", () => {
|
|
setTimeout(render);
|
|
});
|
|
}
|
|
|
|
// Perform i18n and render
|
|
index.Intl(render);
|