Skip to content

Commit af6cf63

Browse files
authored
COMPASS 856: Backport COMPASS 466: Properly remove clipboard detection (#833) (#835)
As `this.boundOnConnectWindowFocused != this.onConnectWindowFocused.bind(this)`, i.e. the `.bind()` creates a new and different function each time it is called, so `window.removeEventListener` doesn't do anything.
1 parent ef0ceeb commit af6cf63

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/app/connect/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,15 @@ var ConnectView = View.extend({
275275
this.replaceSshTunnelMethodFields.bind(this));
276276

277277
// add event listener to focus event and also check on app launch
278-
window.addEventListener('focus', this.onConnectWindowFocused.bind(this));
278+
this.boundOnConnectWindowFocused = this.onConnectWindowFocused.bind(this);
279+
window.addEventListener('focus', this.boundOnConnectWindowFocused);
279280
this.onConnectWindowFocused();
280281

281282
// always start in NEW_EMPTY state
282283
this.dispatch('new connection clicked');
283284
},
284285
remove: function() {
285-
window.removeEventListener('focus', this.onConnectWindowFocused.bind(this));
286+
window.removeEventListener('focus', this.boundOnConnectWindowFocused);
286287
return View.prototype.remove.call(this);
287288
},
288289

0 commit comments

Comments
 (0)