[Libreoffice-commits] online.git: loleaflet/main.js loleaflet/src

Henry Castro hcastro at collabora.com
Wed Sep 13 15:09:53 UTC 2017


 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 7c1e1120c63661d84a5696c5b10a961477228e19
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

diff --git a/loleaflet/main.js b/loleaflet/main.js
index ece21653..5d8aaed0 100644
--- a/loleaflet/main.js
+++ b/loleaflet/main.js
@@ -132,6 +132,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 4614a00d..3ca32cc0 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;
@@ -43,7 +48,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 d66d75f4..df1a3607 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -169,6 +169,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