script.js 497 B

1234567891011121314151617181920212223
  1. class StatisticsPage {
  2. constructor() {
  3. this.userMode = StatisticsUser != null;
  4. }
  5. openSocket() {
  6. this.socket = new Socket('/ws').onMessage(this.onSocketMessage.bind(this));
  7. }
  8. onSocketMessage(e) {
  9. this.statistics.load();
  10. }
  11. start() {
  12. this.openSocket();
  13. this.statistics = Statistics.init(DOM.get('#statistics>.content'), this.userMode ? Statistics.Modes.USER : Statistics.Modes.ALL);
  14. return this;
  15. }
  16. }
  17. window_.on('load', (e) => {
  18. window.page = new StatisticsPage().start();
  19. });