You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
843 B

  1. const perf = require('./performance');
  2. // import default stylesheet with variables
  3. require('font-awesome/css/font-awesome.css');
  4. require('mastodon-application-style');
  5. function onDomContentLoaded(callback) {
  6. if (document.readyState !== 'loading') {
  7. callback();
  8. } else {
  9. document.addEventListener('DOMContentLoaded', callback);
  10. }
  11. }
  12. function main() {
  13. perf.start('main()');
  14. const Mastodon = require('mastodon/containers/mastodon').default;
  15. const React = require('react');
  16. const ReactDOM = require('react-dom');
  17. require.context('../images/', true);
  18. onDomContentLoaded(() => {
  19. const mountNode = document.getElementById('mastodon');
  20. const props = JSON.parse(mountNode.getAttribute('data-props'));
  21. ReactDOM.render(<Mastodon {...props} />, mountNode);
  22. perf.stop('main()');
  23. });
  24. }
  25. export default main;