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

Jan Holesovsky kendy at collabora.com
Tue Feb 9 14:31:21 UTC 2016


 loleaflet/src/core/Socket.js |   37 -------------------------------------
 loleaflet/src/map/Map.js     |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 37 deletions(-)

New commits:
commit 5c01f032a0c3eb941e07b15f4b272f26f949fc92
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Tue Feb 9 15:30:24 2016 +0100

    loleaflet: Move the initializationComplete code around a bit.

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 68dc42d..a287cbd 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -19,43 +19,6 @@ L.Socket = L.Class.extend({
 		this.socket.onopen = L.bind(this._onOpen, this);
 		this.socket.onmessage = L.bind(this._onMessage, this);
 		this.socket.binaryType = 'arraybuffer';
-
-		// When all these conditions are met, fire statusindicator:initializationComplete
-		map.initConditions = {
-			'docLayer': false,
-			'statusindicatorfinish': false,
-			'StyleApply': false,
-			'CharFontName': false,
-			'updatepermission': false
-		};
-		map.initComplete = false;
-
-		map._fireInitComplete = L.bind(this._fireInitComplete, this);
-		map.on('updatepermission', function(e){
-			if (map.initComplete)
-				return;
-			map._fireInitComplete('updatepermission');
-		}).on('commandstatechanged', function(e){
-			if (map.initComplete)
-				return;
-			if (e.commandName === '.uno:StyleApply')
-				map._fireInitComplete('StyleApply');
-			else if (e.commandName === '.uno:CharFontName')
-				map._fireInitComplete('CharFontName');
-		});
-	},
-
-	_fireInitComplete: function (condition) {
-		if (this._map.initComplete)
-			return;
-
-		this._map.initConditions[condition] = true;
-		for (var key in this._map.initConditions) {
-			if (!this._map.initConditions[key])
-				return;
-		}
-		this._map.fire('statusindicator', {statusType: 'initializationComplete'});
-		this._map.initComplete = true;
 	},
 
 	close: function () {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 1d29bb9..a887747 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -80,6 +80,34 @@ L.Map = L.Evented.extend({
 		// Inhibit the context menu - the browser thinks that the document
 		// is just a bunch of images, hence the context menu is useless (tdf#94599)
 		this.on('contextmenu', function() {});
+
+		// When all these conditions are met, fire statusindicator:initializationComplete
+		this.initConditions = {
+			'docLayer': false,
+			'statusindicatorfinish': false,
+			'StyleApply': false,
+			'CharFontName': false,
+			'updatepermission': false
+		};
+		this.initComplete = false;
+
+		this.on('updatepermission', function(e){
+			if (this.initComplete) {
+				return;
+			}
+			this._fireInitComplete('updatepermission');
+		});
+		this.on('commandstatechanged', function(e){
+			if (this.initComplete) {
+				return;
+			}
+			if (e.commandName === '.uno:StyleApply') {
+				this._fireInitComplete('StyleApply');
+			}
+			else if (e.commandName === '.uno:CharFontName') {
+				this._fireInitComplete('CharFontName');
+			}
+		});
 	},
 
 
@@ -475,6 +503,20 @@ L.Map = L.Evented.extend({
 		}
 	},
 
+	_fireInitComplete: function (condition) {
+		if (this.initComplete)
+			return;
+
+		this.initConditions[condition] = true;
+		for (var key in this.initConditions) {
+			if (!this.initConditions[key]) {
+				return;
+			}
+		}
+		this.fire('statusindicator', {statusType: 'initializationComplete'});
+		this.initComplete = true;
+	},
+
 	_initContainer: function (id) {
 		var container = this._container = L.DomUtil.get(id);
 


More information about the Libreoffice-commits mailing list