tsparticles 1.37.3 → 1.37.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1880,6 +1880,7 @@
1880
1880
  this.mouseDownHandler = () => this.mouseDown();
1881
1881
  this.visibilityChangeHandler = () => this.handleVisibilityChange();
1882
1882
  this.themeChangeHandler = e => this.handleThemeChange(e);
1883
+ this.oldThemeChangeHandler = e => this.handleThemeChange(e);
1883
1884
  this.resizeHandler = () => this.handleWindowResize();
1884
1885
  }
1885
1886
  addListeners() {
@@ -1903,9 +1904,17 @@
1903
1904
  } else {
1904
1905
  container.interactivity.element = container.canvas.element;
1905
1906
  }
1906
- const mediaMatch = typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
1907
+ const mediaMatch = !isSsr() && typeof matchMedia !== "undefined" && matchMedia("(prefers-color-scheme: dark)");
1907
1908
  if (mediaMatch) {
1908
- manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1909
+ if (mediaMatch.addEventListener !== undefined) {
1910
+ manageListener(mediaMatch, "change", this.themeChangeHandler, add);
1911
+ } else if (mediaMatch.addListener !== undefined) {
1912
+ if (add) {
1913
+ mediaMatch.addListener(this.oldThemeChangeHandler);
1914
+ } else {
1915
+ mediaMatch.removeListener(this.oldThemeChangeHandler);
1916
+ }
1917
+ }
1909
1918
  }
1910
1919
  const interactivityEl = container.interactivity.element;
1911
1920
  if (!interactivityEl) {