@tarojs/taro-h5 4.1.12-beta.9 → 4.2.0
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.
package/dist/index.esm.js
CHANGED
|
@@ -586,14 +586,7 @@ const onThemeChange = callback => {
|
|
|
586
586
|
if (isNil(themeMatchMedia)) {
|
|
587
587
|
themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
588
588
|
}
|
|
589
|
-
|
|
590
|
-
const mql = themeMatchMedia;
|
|
591
|
-
if (typeof mql.addEventListener === 'function') {
|
|
592
|
-
mql.addEventListener('change', themeChangeListener);
|
|
593
|
-
}
|
|
594
|
-
else if (typeof mql.addListener === 'function') {
|
|
595
|
-
mql.addListener(themeChangeListener);
|
|
596
|
-
}
|
|
589
|
+
themeMatchMedia.addEventListener('change', themeChangeListener);
|
|
597
590
|
}
|
|
598
591
|
};
|
|
599
592
|
const onPageNotFound = callback => {
|
|
@@ -631,14 +624,11 @@ const offUnhandledRejection = callback => {
|
|
|
631
624
|
};
|
|
632
625
|
const offThemeChange = callback => {
|
|
633
626
|
themeChangeCallbackManager.remove(callback);
|
|
634
|
-
if (themeChangeCallbackManager.count() === 0
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
themeMatchMedia.removeEventListener('change', themeChangeListener);
|
|
638
|
-
}
|
|
639
|
-
else if (typeof themeMatchMedia.removeListener === 'function') {
|
|
640
|
-
themeMatchMedia.removeListener(themeChangeListener);
|
|
627
|
+
if (themeChangeCallbackManager.count() === 0) {
|
|
628
|
+
if (isNil(themeMatchMedia)) {
|
|
629
|
+
themeMatchMedia = window.matchMedia('(prefers-color-scheme: light)');
|
|
641
630
|
}
|
|
631
|
+
themeMatchMedia.removeEventListener('change', themeChangeListener);
|
|
642
632
|
themeMatchMedia = null;
|
|
643
633
|
}
|
|
644
634
|
};
|