loleaflet/src/core/Socket.js | 2 ++ loleaflet/src/map/Map.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
New commits: commit 983f282e74a3f00eb2d65ef3cde916f687273bef Author: Jan Holesovsky <[email protected]> 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 e2695b0..2420d91 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -17,43 +17,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 99dc6a6..5cc875d 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); commit dcfb3ea4b27a6915b60f102f96ad6c87fea234a9 Author: Pranav Kant <[email protected]> Date: Tue Feb 9 18:16:10 2016 +0530 loleaflet: Fire event on initialization complete Change-Id: Iaba99d88b1ce770374f9f39a443b169c8c019d72 Reviewed-on: https://gerrit.libreoffice.org/22234 Reviewed-by: Jan Holesovsky <[email protected]> Tested-by: Jan Holesovsky <[email protected]> diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 3f5b701..e2695b0 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -17,6 +17,43 @@ 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 () { @@ -155,6 +192,7 @@ L.Socket = L.Class.extend({ this._map._docLayer = docLayer; this._map.addLayer(docLayer); + this._map._fireInitComplete('docLayer'); } // these can arrive very early during the startup @@ -169,6 +207,7 @@ L.Socket = L.Class.extend({ } else if (textMsg.startsWith('statusindicatorfinish:')) { this._map.fire('statusindicator', {statusType : 'finish'}); + this._map._fireInitComplete('statusindicatorfinish'); return; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
