1
0

chronology.js 1005 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. $(() => {
  2. class Chronology
  3. {
  4. #min = null;
  5. #max = null;
  6. #onChronologyUpdated() {
  7. console.log("Chronology update with ", this.#min, this.#max);
  8. window.ReloadFilters(MediaStorage.Instance);
  9. }
  10. rebuildRange(_minTs, _maxTs) {
  11. let updated = false;
  12. if (!this.#min || this.#min.getTime() !== _minTs) {
  13. this.#min = new Date(_minTs);
  14. updated = true;
  15. }
  16. if (!this.#max || this.#max.getTime() !== _maxTs) {
  17. this.#max = new Date(_maxTs);
  18. updated = true;
  19. }
  20. if (updated)
  21. this.#onChronologyUpdated();
  22. }
  23. getRange() {
  24. return {
  25. min: new Date(this.#min),
  26. max: new Date(this.#max)
  27. };
  28. }
  29. isInitialized() {
  30. return this.#min && this.#max;
  31. }
  32. }
  33. window.chronology = new Chronology();
  34. });