Change api event: "onReady" -> "onAppReady", added "onDocumentReady" event.
This commit is contained in:
parent
ce40913023
commit
9ce1c45226
|
@ -131,9 +131,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'onReady': <document ready callback>,
|
'onReady': <application ready callback>, // deprecated
|
||||||
|
'onAppReady': <application ready callback>,
|
||||||
'onBack': <back to folder callback>,
|
'onBack': <back to folder callback>,
|
||||||
'onDocumentStateChange': <document state changed callback>
|
'onDocumentStateChange': <document state changed callback>
|
||||||
|
'onDocumentReady': <document ready callback>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,9 +166,11 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'onReady': <document ready callback>,
|
'onReady': <application ready callback>, // deprecated
|
||||||
|
'onAppReady': <application ready callback>,
|
||||||
'onBack': <back to folder callback>,
|
'onBack': <back to folder callback>,
|
||||||
'onError': <error callback>,
|
'onError': <error callback>,
|
||||||
|
'onDocumentReady': <document ready callback>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -205,7 +209,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var _onReady = function() {
|
var _onAppReady = function() {
|
||||||
if (_config.type === 'mobile') {
|
if (_config.type === 'mobile') {
|
||||||
document.body.onfocus = function(e) {
|
document.body.onfocus = function(e) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
@ -275,8 +279,8 @@
|
||||||
} else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
|
} else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
|
||||||
_callLocalStorage(msg.data.data);
|
_callLocalStorage(msg.data.data);
|
||||||
} else {
|
} else {
|
||||||
if (msg.event === 'onReady') {
|
if (msg.event === 'onAppReady') {
|
||||||
_onReady();
|
_onAppReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler) {
|
if (handler) {
|
||||||
|
|
|
@ -138,8 +138,9 @@ if (Common === undefined) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
ready: function() {
|
appReady: function() {
|
||||||
_postMessage({ event: 'onReady' });
|
_postMessage({ event: 'onReady' });
|
||||||
|
_postMessage({ event: 'onAppReady' });
|
||||||
},
|
},
|
||||||
|
|
||||||
requestEditRights: function() {
|
requestEditRights: function() {
|
||||||
|
@ -236,6 +237,10 @@ if (Common === undefined) {
|
||||||
_postMessage({event: 'onMetaChange', data: meta});
|
_postMessage({event: 'onMetaChange', data: meta});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
documentReady: function() {
|
||||||
|
_postMessage({ event: 'onDocumentReady' });
|
||||||
|
},
|
||||||
|
|
||||||
on: function(event, handler){
|
on: function(event, handler){
|
||||||
var localHandler = function(event, data){
|
var localHandler = function(event, data){
|
||||||
handler.call(me, data)
|
handler.call(me, data)
|
||||||
|
|
|
@ -77,7 +77,7 @@ define([
|
||||||
user : {id: ('uid-'+Date.now())}
|
user : {id: ('uid-'+Date.now())}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'onReady' : function() {},
|
'onAppReady' : function() {},
|
||||||
'onDocumentStateChange' : function() {},
|
'onDocumentStateChange' : function() {},
|
||||||
'onError' : function() {},
|
'onError' : function() {},
|
||||||
'onInternalMessage' : _.bind(this.onInternalMessage, this)
|
'onInternalMessage' : _.bind(this.onInternalMessage, this)
|
||||||
|
|
|
@ -77,7 +77,7 @@ define([
|
||||||
user : {id: ('uid-'+Date.now())}
|
user : {id: ('uid-'+Date.now())}
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'onReady' : function() {},
|
'onAppReady' : function() {},
|
||||||
'onDocumentStateChange' : function() {},
|
'onDocumentStateChange' : function() {},
|
||||||
'onError' : function() {},
|
'onError' : function() {},
|
||||||
'onInternalMessage' : _.bind(this.onInternalMessage, this)
|
'onInternalMessage' : _.bind(this.onInternalMessage, this)
|
||||||
|
|
|
@ -209,6 +209,8 @@ var ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDocumentContentReady() {
|
function onDocumentContentReady() {
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
hidePreloader();
|
hidePreloader();
|
||||||
|
|
||||||
if ( !embedConfig.shareUrl )
|
if ( !embedConfig.shareUrl )
|
||||||
|
@ -498,7 +500,7 @@ var ApplicationController = new(function(){
|
||||||
Common.Gateway.on('init', loadConfig);
|
Common.Gateway.on('init', loadConfig);
|
||||||
Common.Gateway.on('opendocument', loadDocument);
|
Common.Gateway.on('opendocument', loadDocument);
|
||||||
Common.Gateway.on('showmessage', onExternalMessage);
|
Common.Gateway.on('showmessage', onExternalMessage);
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
|
|
|
@ -173,7 +173,7 @@ define([
|
||||||
Common.Gateway.on('init', _.bind(this.loadConfig, this));
|
Common.Gateway.on('init', _.bind(this.loadConfig, this));
|
||||||
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
|
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
|
|
||||||
// $(window.top).resize(_.bind(this.onDocumentResize, this));
|
// $(window.top).resize(_.bind(this.onDocumentResize, this));
|
||||||
this.getApplication().getController('Viewport').setApi(this.api);
|
this.getApplication().getController('Viewport').setApi(this.api);
|
||||||
|
@ -740,6 +740,8 @@ define([
|
||||||
if (this._isDocReady)
|
if (this._isDocReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
if (this._state.openDlg)
|
if (this._state.openDlg)
|
||||||
this._state.openDlg.close();
|
this._state.openDlg.close();
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ define([
|
||||||
Common.Gateway.on('init', _.bind(me.loadConfig, me));
|
Common.Gateway.on('init', _.bind(me.loadConfig, me));
|
||||||
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
||||||
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
|
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -456,6 +456,8 @@ define([
|
||||||
if (this._isDocReady)
|
if (this._isDocReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
if (this._state.openDlg)
|
if (this._state.openDlg)
|
||||||
uiApp.closeModal(this._state.openDlg);
|
uiApp.closeModal(this._state.openDlg);
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,8 @@ var ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDocumentContentReady() {
|
function onDocumentContentReady() {
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
api.ShowThumbnails(false);
|
api.ShowThumbnails(false);
|
||||||
api.asc_DeleteVerticalScroll();
|
api.asc_DeleteVerticalScroll();
|
||||||
|
|
||||||
|
@ -574,7 +576,7 @@ var ApplicationController = new(function(){
|
||||||
Common.Gateway.on('init', loadConfig);
|
Common.Gateway.on('init', loadConfig);
|
||||||
Common.Gateway.on('opendocument', loadDocument);
|
Common.Gateway.on('opendocument', loadDocument);
|
||||||
Common.Gateway.on('showmessage', onExternalMessage);
|
Common.Gateway.on('showmessage', onExternalMessage);
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
|
|
|
@ -174,7 +174,7 @@ define([
|
||||||
Common.Gateway.on('init', _.bind(this.loadConfig, this));
|
Common.Gateway.on('init', _.bind(this.loadConfig, this));
|
||||||
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
Common.Gateway.on('opendocument', _.bind(this.loadDocument, 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('Viewport').setApi(this.api);
|
||||||
this.getApplication().getController('Statusbar').setApi(me.api);
|
this.getApplication().getController('Statusbar').setApi(me.api);
|
||||||
|
@ -552,6 +552,8 @@ define([
|
||||||
if (this._isDocReady)
|
if (this._isDocReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
if (this._state.openDlg)
|
if (this._state.openDlg)
|
||||||
this._state.openDlg.close();
|
this._state.openDlg.close();
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ define([
|
||||||
Common.Gateway.on('init', _.bind(me.loadConfig, me));
|
Common.Gateway.on('init', _.bind(me.loadConfig, me));
|
||||||
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
||||||
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
|
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
me.initNames();
|
me.initNames();
|
||||||
|
@ -443,6 +443,8 @@ define([
|
||||||
if (this._isDocReady)
|
if (this._isDocReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
if (this._state.openDlg)
|
if (this._state.openDlg)
|
||||||
uiApp.closeModal(this._state.openDlg);
|
uiApp.closeModal(this._state.openDlg);
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,8 @@ var ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDocumentContentReady() {
|
function onDocumentContentReady() {
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
hidePreloader();
|
hidePreloader();
|
||||||
|
|
||||||
if ( !embedConfig.shareUrl )
|
if ( !embedConfig.shareUrl )
|
||||||
|
@ -520,7 +522,7 @@ var ApplicationController = new(function(){
|
||||||
Common.Gateway.on('init', loadConfig);
|
Common.Gateway.on('init', loadConfig);
|
||||||
Common.Gateway.on('opendocument', loadDocument);
|
Common.Gateway.on('opendocument', loadDocument);
|
||||||
Common.Gateway.on('showmessage', onExternalMessage);
|
Common.Gateway.on('showmessage', onExternalMessage);
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
|
|
|
@ -180,7 +180,7 @@ define([
|
||||||
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
|
Common.Gateway.on('showmessage', _.bind(this.onExternalMessage, this));
|
||||||
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
|
Common.Gateway.on('opendocument', _.bind(this.loadDocument, this));
|
||||||
Common.Gateway.on('internalcommand', _.bind(this.onInternalCommand, this));
|
Common.Gateway.on('internalcommand', _.bind(this.onInternalCommand, this));
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
|
|
||||||
this.getApplication().getController('Viewport').setApi(this.api);
|
this.getApplication().getController('Viewport').setApi(this.api);
|
||||||
|
|
||||||
|
@ -555,6 +555,8 @@ define([
|
||||||
if (this._isDocReady)
|
if (this._isDocReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
if (this._state.openDlg)
|
if (this._state.openDlg)
|
||||||
this._state.openDlg.close();
|
this._state.openDlg.close();
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ define([
|
||||||
Common.Gateway.on('init', _.bind(me.loadConfig, me));
|
Common.Gateway.on('init', _.bind(me.loadConfig, me));
|
||||||
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
Common.Gateway.on('showmessage', _.bind(me.onExternalMessage, me));
|
||||||
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
|
Common.Gateway.on('opendocument', _.bind(me.loadDocument, me));
|
||||||
Common.Gateway.ready();
|
Common.Gateway.appReady();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -455,6 +455,8 @@ define([
|
||||||
if (this._isDocReady)
|
if (this._isDocReady)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Common.Gateway.documentReady();
|
||||||
|
|
||||||
if (this._state.openDlg)
|
if (this._state.openDlg)
|
||||||
uiApp.closeModal(this._state.openDlg);
|
uiApp.closeModal(this._state.openDlg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue