Merge pull request #1661 from ONLYOFFICE/feature/fix-load-docinfo
Fix loading doc-info for large pdf (show download progress)
This commit is contained in:
commit
e19540a132
|
@ -658,7 +658,9 @@ class MainController extends Component {
|
||||||
const storeDocumentInfo = this.props.storeDocumentInfo;
|
const storeDocumentInfo = this.props.storeDocumentInfo;
|
||||||
|
|
||||||
this.api.asc_registerCallback("asc_onGetDocInfoStart", () => {
|
this.api.asc_registerCallback("asc_onGetDocInfoStart", () => {
|
||||||
storeDocumentInfo.switchIsLoaded(false);
|
this.timerLoading = setTimeout(() => {
|
||||||
|
storeDocumentInfo.switchIsLoaded(false);
|
||||||
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api.asc_registerCallback("asc_onGetDocInfoStop", () => {
|
this.api.asc_registerCallback("asc_onGetDocInfoStop", () => {
|
||||||
|
@ -666,10 +668,20 @@ class MainController extends Component {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api.asc_registerCallback("asc_onDocInfo", (obj) => {
|
this.api.asc_registerCallback("asc_onDocInfo", (obj) => {
|
||||||
storeDocumentInfo.changeCount(obj);
|
clearTimeout(this.timerLoading);
|
||||||
|
|
||||||
|
this.objectInfo = obj;
|
||||||
|
if(!this.timerDocInfo) {
|
||||||
|
this.timerDocInfo = setInterval(() => {
|
||||||
|
storeDocumentInfo.changeCount(this.objectInfo);
|
||||||
|
}, 300);
|
||||||
|
storeDocumentInfo.changeCount(this.objectInfo);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onGetDocInfoEnd', () => {
|
this.api.asc_registerCallback('asc_onGetDocInfoEnd', () => {
|
||||||
|
clearTimeout(this.timerLoading);
|
||||||
|
clearInterval(this.timerDocInfo);
|
||||||
storeDocumentInfo.switchIsLoaded(true);
|
storeDocumentInfo.switchIsLoaded(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class storeDocumentInfo {
|
||||||
symbolsWSCount: 0,
|
symbolsWSCount: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
isLoaded = false;
|
isLoaded = true;
|
||||||
dataDoc;
|
dataDoc;
|
||||||
|
|
||||||
switchIsLoaded(value) {
|
switchIsLoaded(value) {
|
||||||
|
|
Loading…
Reference in a new issue