File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ export default {
135135 }
136136
137137 xhr .open (' GET' , url, true )
138- xhr .addEventListener (' load' , onLoad)
138+ xhr .addEventListener (' load' , onLoad, {
139+ signal: this .controller ? this .controller .signal : undefined
140+ })
139141 // Initiate the request
140142 xhr .send ()
141143 },
@@ -248,6 +250,14 @@ export default {
248250 // Donors are people/organizations with one-time (paid) donations
249251 this .makeOcRequest (this .processDonors .bind (this ), { status: ' paid' })
250252 }
253+ },
254+
255+ beforeDestroy () {
256+ this .controller .abort ()
257+ },
258+
259+ created () {
260+ this .controller = new window.AbortController ()
251261 }
252262}
253263 </script >
Original file line number Diff line number Diff line change @@ -52,10 +52,16 @@ export default {
5252 }
5353 },
5454 created () {
55- this . $root . $on ( ' docs-set-toc ' , toc => {
55+ const handleDocsSetToc = toc => {
5656 this .expanded = false
5757 // Update the TOC content
5858 this .toc = toc
59+ }
60+
61+ this .$root .$on (' docs-set-toc' , handleDocsSetToc)
62+
63+ this .$once (' hook:beforeDestroy' , () => {
64+ this .$root .$off (' docs-set-toc' , handleDocsSetToc)
5965 })
6066 },
6167 mounted () {
Original file line number Diff line number Diff line change @@ -57,8 +57,14 @@ export default {
5757 }
5858 },
5959 created () {
60- this . $root . $on ( ' docs-set-toc ' , toc => {
60+ const handleDocsSetToc = toc => {
6161 this .toc = toc
62+ }
63+
64+ this .$root .$on (' docs-set-toc' , handleDocsSetToc)
65+
66+ this .$once (' hook:beforeDestroy' , () => {
67+ this .$root .$off (' docs-set-toc' , handleDocsSetToc)
6268 })
6369 },
6470 mounted () {
You can’t perform that action at this time.
0 commit comments