mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
socket: Correctly reference the socket object inside event handlers
(imported from commit d5954007764f5e5e30b15d1af8e9b3c43a3ebde9)
This commit is contained in:
@@ -11,13 +11,14 @@ function Socket(url) {
|
|||||||
this._reconnect_timeout_id = null;
|
this._reconnect_timeout_id = null;
|
||||||
this._heartbeat_timeout_id = null;
|
this._heartbeat_timeout_id = null;
|
||||||
|
|
||||||
|
var that = this;
|
||||||
this._is_unloading = false;
|
this._is_unloading = false;
|
||||||
$(window).on("unload", function () {
|
$(window).on("unload", function () {
|
||||||
this._is_unloading = true;
|
that._is_unloading = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("unsuspend", function () {
|
$(document).on("unsuspend", function () {
|
||||||
this._try_to_reconnect();
|
that._try_to_reconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
this._supported_protocols = ['websocket', 'xdr-streaming', 'xhr-streaming',
|
this._supported_protocols = ['websocket', 'xdr-streaming', 'xhr-streaming',
|
||||||
|
|||||||
Reference in New Issue
Block a user