Skip to content

Commit 08c047c

Browse files
committed
feat: Remove onunload handler before redirecting
Fixes #138
1 parent 6498755 commit 08c047c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/embedded.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ class HelloSign extends Emitter {
669669
this._sendConfigurationMessage();
670670
this._clearInitTimeout();
671671

672+
window.addEventListener('beforeunload', this._onBeforeUnload);
673+
672674
this.emit(settings.events.READY, payload);
673675
}
674676

@@ -827,6 +829,8 @@ class HelloSign extends Emitter {
827829

828830
this._isSentOrSigned = true;
829831

832+
window.removeEventListener('beforeunload', this._onBeforeUnload);
833+
830834
this.emit(settings.events.SEND, payload);
831835
}
832836

@@ -848,6 +852,8 @@ class HelloSign extends Emitter {
848852

849853
this._isSentOrSigned = true;
850854

855+
window.removeEventListener('beforeunload', this._onBeforeUnload);
856+
851857
this.emit(settings.events.SIGN, payload);
852858
}
853859

@@ -1049,7 +1055,6 @@ class HelloSign extends Emitter {
10491055
this._isOpen = true;
10501056

10511057
window.addEventListener('message', this._onMessage);
1052-
window.addEventListener('beforeunload', this._onBeforeUnload);
10531058

10541059
this.emit(settings.events.OPEN, {
10551060
url: this._iFrameURL.href,

0 commit comments

Comments
 (0)