Commit 06a5c330 authored by Julia Radzhabova's avatar Julia Radzhabova

Change api event: "onReady" -> "onAppReady", added "onDocumentReady" event.

parent 1fbf9c9e
......@@ -131,9 +131,11 @@
}
},
events: {
'onReady': <document ready callback>,
'onReady': <application ready callback>, // deprecated
'onAppReady': <application ready callback>,
'onBack': <back to folder callback>,
'onDocumentStateChange': <document state changed callback>
'onDocumentReady': <document ready callback>
}
}
......@@ -164,9 +166,11 @@
}
},
events: {
'onReady': <document ready callback>,
'onReady': <application ready callback>, // deprecated
'onAppReady': <application ready callback>,
'onBack': <back to folder callback>,
'onError': <error callback>,
'onDocumentReady': <document ready callback>
}
}
*/
......@@ -205,7 +209,7 @@
}
};
var _onReady = function() {
var _onAppReady = function() {
if (_config.type === 'mobile') {
document.body.onfocus = function(e) {
setTimeout(function(){
......@@ -275,8 +279,8 @@
} else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
_callLocalStorage(msg.data.data);
} else {
if (msg.event === 'onReady') {
_onReady();
if (msg.event === 'onAppReady') {
_onAppReady();
}
if (handler) {
......
......@@ -138,8 +138,9 @@ if (Common === undefined) {
return {
ready: function() {
appReady: function() {
_postMessage({ event: 'onReady' });
_postMessage({ event: 'onAppReady' });
},
requestEditRights: function() {
......@@ -236,6 +237,10 @@ if (Common === undefined) {
_postMessage({event: 'onMetaChange', data: meta});
},
documentReady: function() {
_postMessage({ event: 'onDocumentReady' });
},
on: function(event, handler){
var localHandler = function(event, data){
handler.call(me, data)
......
......@@ -77,7 +77,7 @@ define([
user : {id: ('uid-'+Date.now())}
},
events: {
'onReady' : function() {},
'onAppReady' : function() {},
'onDocumentStateChange' : function() {},
'onError' : function() {},
'onInternalMessage' : _.bind(this.onInternalMessage, this)
......
......@@ -77,7 +77,7 @@ define([
user : {id: ('uid-'+Date.now())}
},
events: {
'onReady' : function() {},
'onAppReady' : function() {},
'onDocumentStateChange' : function() {},
'onError' : function() {},
'onInternalMessage' : _.bind(this.onInternalMessage, this)
......
......@@ -209,6 +209,8 @@ var ApplicationController = new(function(){
}
function onDocumentContentReady() {
Common.Gateway.documentReady();
hidePreloader();
if ( !embedConfig.shareUrl )
......@@ -498,7 +500,7 @@ var ApplicationController = new(function(){
Common.Gateway.on('init', loadConfig);
Common.Gateway.on('opendocument', loadDocument);
Common.Gateway.on('showmessage', onExternalMessage);
Common.Gateway.ready();
Common.Gateway.appReady();
}
return me;
......
......@@ -172,7 +172,7 @@ define([
Common.Gateway.on('init', _.bind(this.loadConfig, this));
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
Common.Gateway.ready();
Common.Gateway.appReady();
// $(window.top).resize(_.bind(this.onDocumentResize, this));
this.getApplication().getController('Viewport').setApi(this.api);
......@@ -749,6 +749,8 @@ define([
if (this._isDocReady)
return;
Common.Gateway.documentReady();
var me = this,
value;
......
......@@ -167,7 +167,7 @@ define([
Common.Gateway.on('init', _.bind(me.loadConfig, me));
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
Common.Gateway.ready();
Common.Gateway.appReady();
}
},
......@@ -457,6 +457,8 @@ define([
if (this._isDocReady)
return;
Common.Gateway.documentReady();
if (this._state.openDlg)
uiApp.closeModal(this._state.openDlg);
......
......@@ -211,6 +211,8 @@ var ApplicationController = new(function(){
}
function onDocumentContentReady() {
Common.Gateway.documentReady();
api.ShowThumbnails(false);
api.asc_DeleteVerticalScroll();
......@@ -574,7 +576,7 @@ var ApplicationController = new(function(){
Common.Gateway.on('init', loadConfig);
Common.Gateway.on('opendocument', loadDocument);
Common.Gateway.on('showmessage', onExternalMessage);
Common.Gateway.ready();
Common.Gateway.appReady();
}
return me;
......
......@@ -172,7 +172,7 @@ define([
Common.Gateway.on('init', _.bind(this.loadConfig, this));
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
Common.Gateway.ready();
Common.Gateway.appReady();
this.getApplication().getController('Viewport').setApi(this.api);
this.getApplication().getController('Statusbar').setApi(me.api);
......@@ -555,6 +555,8 @@ define([
if (this._isDocReady)
return;
Common.Gateway.documentReady();
var me = this,
value;
......
......@@ -168,7 +168,7 @@ define([
Common.Gateway.on('init', _.bind(me.loadConfig, me));
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
Common.Gateway.ready();
Common.Gateway.appReady();
}
me.initNames();
......@@ -443,6 +443,8 @@ define([
if (this._isDocReady)
return;
Common.Gateway.documentReady();
if (this._state.openDlg)
uiApp.closeModal(this._state.openDlg);
......
......@@ -166,6 +166,8 @@ var ApplicationController = new(function(){
}
function onDocumentContentReady() {
Common.Gateway.documentReady();
hidePreloader();
if ( !embedConfig.shareUrl )
......@@ -520,7 +522,7 @@ var ApplicationController = new(function(){
Common.Gateway.on('init', loadConfig);
Common.Gateway.on('opendocument', loadDocument);
Common.Gateway.on('showmessage', onExternalMessage);
Common.Gateway.ready();
Common.Gateway.appReady();
}
return me;
......
......@@ -180,7 +180,7 @@ define([
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
Common.Gateway.on('internalcommand', _.bind(this.onInternalCommand, this));
Common.Gateway.ready();
Common.Gateway.appReady();
this.getApplication().getController('Viewport').setApi(this.api);
......@@ -555,6 +555,8 @@ define([
if (this._isDocReady)
return;
Common.Gateway.documentReady();
var me = this,
value;
......
......@@ -174,7 +174,7 @@ define([
Common.Gateway.on('init', _.bind(me.loadConfig, me));
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
Common.Gateway.ready();
Common.Gateway.appReady();
}
},
......@@ -455,6 +455,8 @@ define([
if (this._isDocReady)
return;
Common.Gateway.documentReady();
if (this._state.openDlg)
uiApp.closeModal(this._state.openDlg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment