MOBILE-3320 scorm: Fix SCORM disappearing after changing tab

main
Dani Palou 2021-06-02 09:48:56 +02:00
parent 5a528381b2
commit cab43925a5
1 changed files with 4 additions and 10 deletions

View File

@ -362,16 +362,6 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
} }
} }
/**
* Page will leave.
*/
ionViewWillLeave(): void {
CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'scorm' });
// Empty src when leaving the state so unload event is triggered in the iframe.
this.src = '';
}
/** /**
* Load a SCO. * Load a SCO.
* *
@ -547,6 +537,10 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
* Component being destroyed. * Component being destroyed.
*/ */
ngOnDestroy(): void { ngOnDestroy(): void {
// Empty src when leaving the state so unload event is triggered in the iframe.
this.src = '';
CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'scorm' });
// Stop listening for events. // Stop listening for events.
this.tocObserver?.off(); this.tocObserver?.off();
this.launchNextObserver?.off(); this.launchNextObserver?.off();