PR feedback
This commit is contained in:
@@ -6,6 +6,8 @@ export default class extends BridgeComponent {
|
||||
static targets = [ "button" ]
|
||||
|
||||
connect() {
|
||||
super.connect()
|
||||
|
||||
if (!this.beforeUnloadHandler) {
|
||||
this.beforeUnloadHandler = this.handleBeforeUnload.bind(this)
|
||||
}
|
||||
@@ -14,6 +16,8 @@ export default class extends BridgeComponent {
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
super.disconnect()
|
||||
|
||||
if (this.beforeUnloadHandler) {
|
||||
window.removeEventListener("beforeunload", this.beforeUnloadHandler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user