Skip to content

Commit 10249ad

Browse files
authored
chore: use addEventListener instead of addListener (#15923)
Use addEventListener() instead of matchMedia().addListener() since matchMedia().addListener() is deprecated.
1 parent 5f5c1fb commit 10249ad

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

docs/src/assets/js/components-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
if (matchMedia) {
88
const mq = window.matchMedia("(max-width: 1023px)");
9-
mq.addListener(WidthChange);
9+
mq.addEventListener('change', WidthChange);
1010
WidthChange(mq);
1111
}
1212

docs/src/assets/js/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
if (toc && matchMedia) {
88
const mq = window.matchMedia("(max-width: 1023px)");
9-
mq.addListener(WidthChange);
9+
mq.addEventListener('change', WidthChange);
1010
WidthChange(mq);
1111
}
1212

@@ -53,7 +53,7 @@
5353

5454
if (matchMedia) {
5555
const mq = window.matchMedia("(max-width: 1023px)");
56-
mq.addListener(WidthChange);
56+
mq.addEventListener('change', WidthChange);
5757
WidthChange(mq);
5858
}
5959

@@ -93,7 +93,7 @@
9393

9494
if (matchMedia) {
9595
const mq = window.matchMedia("(max-width: 1023px)");
96-
mq.addListener(WidthChange);
96+
mq.addEventListener('change', WidthChange);
9797
WidthChange(mq);
9898
}
9999

0 commit comments

Comments
 (0)