0
Good morning.
In my code I have a method described below:
public async DownloadOperacaoCodigos() {
this.total = 0;
this.contador = 0;
// this.loading.presentNoDuration('Carregando Códigos de Operação');
this.loading.present();
//carrega dados
this.modelOperacao = new Operacao();
debugger;
this.operacaoDbService.GetAll()
.then(async (result: any) => {
this.total = result.data.length;
for (var i = 0; i < result.data.length; i++) {
this.modelOperacao = new Operacao();
var operacaoCodigo = result.data[i];
this.modelOperacao.gid = operacaoCodigo.gid;
this.modelOperacao.grupo = operacaoCodigo.grupo;
this.modelOperacao.codigo = operacaoCodigo.codigo;
this.modelOperacao.nome = operacaoCodigo.nome;
this.modelOperacao.descricao = operacaoCodigo.descricao;
await this.operacaoLocalService.Add(this.modelOperacao);
this.contador += 1;
if (this.total == this.contador ) {
this.loading.dismiss();
this.toastCtrl.presentToast('Dados de operação baixado com sucesso.');
}
}
})
.catch((error: any) => {
this.loading.dismiss();
this.toastCtrl.presentToast('Erro ao inserir dados de operação no dispositivo.');
});
It takes a certain time to run, this is no problem, it takes even.
The question would be: I can monitor this process anywhere in the app? The user leaves the page and display something that the process is still running?