File tree 3 files changed +25
-3
lines changed
3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ export default {
135
135
}
136
136
137
137
xhr .open (' GET' , url, true )
138
- xhr .addEventListener (' load' , onLoad)
138
+ xhr .addEventListener (' load' , onLoad, {
139
+ signal: this .controller ? this .controller .signal : undefined
140
+ })
139
141
// Initiate the request
140
142
xhr .send ()
141
143
},
@@ -248,6 +250,14 @@ export default {
248
250
// Donors are people/organizations with one-time (paid) donations
249
251
this .makeOcRequest (this .processDonors .bind (this ), { status: ' paid' })
250
252
}
253
+ },
254
+
255
+ beforeDestroy () {
256
+ this .controller .abort ()
257
+ },
258
+
259
+ created () {
260
+ this .controller = new window.AbortController ()
251
261
}
252
262
}
253
263
</script >
Original file line number Diff line number Diff line change @@ -52,10 +52,16 @@ export default {
52
52
}
53
53
},
54
54
created () {
55
- this . $root . $on ( ' docs-set-toc ' , toc => {
55
+ const handleDocsSetToc = toc => {
56
56
this .expanded = false
57
57
// Update the TOC content
58
58
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)
59
65
})
60
66
},
61
67
mounted () {
Original file line number Diff line number Diff line change @@ -57,8 +57,14 @@ export default {
57
57
}
58
58
},
59
59
created () {
60
- this . $root . $on ( ' docs-set-toc ' , toc => {
60
+ const handleDocsSetToc = toc => {
61
61
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)
62
68
})
63
69
},
64
70
mounted () {
You can’t perform that action at this time.
0 commit comments