diff --git a/src/core/components/loading/loading.ts b/src/core/components/loading/loading.ts index dd06222c0..2fbd213cc 100644 --- a/src/core/components/loading/loading.ts +++ b/src/core/components/loading/loading.ts @@ -103,23 +103,19 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit { * @return Promise resolved when done. */ async changeState(loaded: boolean): Promise { - await CoreUtils.nextTick(); - this.element.classList.toggle('core-loading-loaded', loaded); - this.content?.nativeElement.classList.add('core-loading-content', loaded); - - await CoreUtils.nextTick(); - - // Wait for next tick before triggering the event to make sure ngIf elements have been added to the DOM. - CoreEvents.trigger(CoreEvents.CORE_LOADING_CHANGED, { - loaded: loaded, - uniqueId: this.uniqueId, - }); + this.content?.nativeElement.classList.toggle('core-loading-content', loaded); if (!this.loaded && loaded) { this.loaded = true; // Only comes true once. this.firstLoadedPromise.resolve(this.uniqueId); } + + // Event has been deprecated since app 4.0. + CoreEvents.trigger(CoreEvents.CORE_LOADING_CHANGED, { + loaded: true, + uniqueId: this.uniqueId, + }); } /** diff --git a/src/core/singletons/events.ts b/src/core/singletons/events.ts index f69e0ea0a..33042ddfc 100644 --- a/src/core/singletons/events.ts +++ b/src/core/singletons/events.ts @@ -117,6 +117,9 @@ export class CoreEvents { static readonly APP_LAUNCHED_URL = 'app_launched_url'; // App opened with a certain URL (custom URL scheme). static readonly FILE_SHARED = 'file_shared'; static readonly KEYBOARD_CHANGE = 'keyboard_change'; + /** + * @deprecated since app 4.0. Use CoreComponentsRegistry promises instead. + */ static readonly CORE_LOADING_CHANGED = 'core_loading_changed'; static readonly ORIENTATION_CHANGE = 'orientation_change'; static readonly SEND_ON_ENTER_CHANGED = 'send_on_enter_changed';