Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

index.web.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* global APP */
  2. import React from 'react';
  3. import ReactDOM from 'react-dom';
  4. import { browserHistory } from 'react-router';
  5. import { routerMiddleware, routerReducer } from 'react-router-redux';
  6. import { compose, createStore } from 'redux';
  7. import Thunk from 'redux-thunk';
  8. import config from './config';
  9. import { App } from './features/app';
  10. import { MiddlewareRegistry, ReducerRegistry } from './features/base/redux';
  11. const logger = require('jitsi-meet-logger').getLogger(__filename);
  12. // Create combined reducer from all reducers in registry + routerReducer from
  13. // 'react-router-redux' module (stores location updates from history).
  14. // @see https://github.com/reactjs/react-router-redux#routerreducer.
  15. const reducer = ReducerRegistry.combineReducers({
  16. routing: routerReducer
  17. });
  18. // Apply all registered middleware from the MiddlewareRegistry + additional
  19. // 3rd party middleware:
  20. // - Thunk - allows us to dispatch async actions easily. For more info
  21. // @see https://github.com/gaearon/redux-thunk.
  22. // - routerMiddleware - middleware from 'react-router-redux' module to track
  23. // changes in browser history inside Redux state. For more information
  24. // @see https://github.com/reactjs/react-router-redux.
  25. let middleware = MiddlewareRegistry.applyMiddleware(
  26. Thunk,
  27. routerMiddleware(browserHistory));
  28. // Try to enable Redux DevTools Chrome extension in order to make it available
  29. // for the purposes of facilitating development.
  30. let devToolsExtension;
  31. if (typeof window === 'object'
  32. && (devToolsExtension = window.devToolsExtension)) {
  33. middleware = compose(middleware, devToolsExtension());
  34. }
  35. // Create Redux store with our reducer and middleware.
  36. const store = createStore(reducer, middleware);
  37. /**
  38. * Renders the app when the DOM tree has been loaded.
  39. */
  40. document.addEventListener('DOMContentLoaded', () => {
  41. const now = window.performance.now();
  42. APP.connectionTimes['document.ready'] = now;
  43. logger.log('(TIME) document ready:\t', now);
  44. // Render the main Component.
  45. ReactDOM.render(
  46. <App
  47. config = { config }
  48. store = { store }
  49. url = { window.location.toString() } />,
  50. document.getElementById('react'));
  51. });
  52. /**
  53. * Stops collecting the logs and disposing the API when the user closes the
  54. * page.
  55. */
  56. window.addEventListener('beforeunload', () => {
  57. // Stop the LogCollector
  58. if (APP.logCollectorStarted) {
  59. APP.logCollector.stop();
  60. APP.logCollectorStarted = false;
  61. }
  62. APP.API.dispose();
  63. });