[Libreoffice-commits] online.git: Branch 'libreoffice-5-4' - loleaflet/main.js loleaflet/src

Henry Castro hcastro at collabora.com
Wed Jan 31 16:53:07 UTC 2018


 loleaflet/main.js            |    1 +
 loleaflet/src/core/Socket.js |    6 +++++-
 loleaflet/src/map/Map.js     |    4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 02c7191699eaf7c73d3bd21d816c68d86976c17a
Author: Henry Castro <hcastro at collabora.com>
Date:   Wed Sep 13 11:09:56 2017 -0400

    loleaflet: ensure initialize map components before the document is loaded
    
    Change-Id: I3b6219926f0f9d0306ef25bc5f9a9145410bac74
    (cherry picked from commit 7c1e1120c63661d84a5696c5b10a961477228e19)
    Reviewed-on: https://gerrit.libreoffice.org/49009
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/loleaflet/main.js b/loleaflet/main.js
index 48200cd9..041f338d 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -128,6 +128,7 @@ map.addControl(L.control.columnHeader());
 map.addControl(L.control.rowHeader());
 map.addControl(L.control.contextMenu());
 map.addControl(L.control.menubar());
+map.loadDocument();
 
 window.addEventListener('beforeunload', function () {
 	if (global.map && global.map._socket) {
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index fdce2a54..f02bdacd 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -18,6 +18,11 @@ L.Socket = L.Class.extend({
 	initialize: function (map) {
 		console.debug('socket.initialize:');
 		this._map = map;
+		this._msgQueue = [];
+	},
+
+	connect: function() {
+		var map = this._map;
 		try {
 			if (map.options.permission) {
 				map.options.docParams['permission'] = map.options.permission;
@@ -39,7 +44,6 @@ L.Socket = L.Class.extend({
 			this._accessTokenExpireTimeout = setTimeout(L.bind(this._sessionExpiredWarning, this),
 			                                            parseInt(map.options.docParams.access_token_ttl) - Date.now() - tokenExpiryWarning);
 		}
-		this._msgQueue = [];
 	},
 
 	_sessionExpiredWarning: function() {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 03e5a63a..9324bf24 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -147,6 +147,10 @@ L.Map = L.Evented.extend({
 		}, this);
 	},
 
+	loadDocument: function() {
+		this._socket.connect();
+	},
+
 	// public methods that modify map state
 
 	getViewId: function (username) {


More information about the Libreoffice-commits mailing list