Fix loading doc-info for large pdf (show download progress)

This commit is contained in:
Andrey Shimagin 2022-03-29 08:22:24 +03:00
parent 730da9f345
commit 9a492900ab
2 changed files with 15 additions and 3 deletions

View file

@ -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", () => {
this.timerLoading = setTimeout(() => {
storeDocumentInfo.switchIsLoaded(false); storeDocumentInfo.switchIsLoaded(false);
}, 2000);
}); });
this.api.asc_registerCallback("asc_onGetDocInfoStop", () => { this.api.asc_registerCallback("asc_onGetDocInfoStop", () => {
@ -666,11 +668,21 @@ class MainController extends Component {
}); });
this.api.asc_registerCallback("asc_onDocInfo", (obj) => { this.api.asc_registerCallback("asc_onDocInfo", (obj) => {
storeDocumentInfo.changeCount(obj); this.objectInfo = obj;
if(!this.timerDocInfo) {
this.timerDocInfo = setInterval(() => {
storeDocumentInfo.changeCount(this.objectInfo);
}, 300);
storeDocumentInfo.changeCount(this.objectInfo);
}
clearTimeout(this.timerLoading);
}); });
this.api.asc_registerCallback('asc_onGetDocInfoEnd', () => { this.api.asc_registerCallback('asc_onGetDocInfoEnd', () => {
storeDocumentInfo.switchIsLoaded(true); storeDocumentInfo.switchIsLoaded(true);
clearTimeout(this.timerLoading);
clearInterval(this.timerDocInfo);
}); });
// Color Schemes // Color Schemes

View file

@ -20,7 +20,7 @@ export class storeDocumentInfo {
symbolsWSCount: 0, symbolsWSCount: 0,
}; };
isLoaded = false; isLoaded = true;
dataDoc; dataDoc;
switchIsLoaded(value) { switchIsLoaded(value) {