Manage Application Level and Page Level Context

How to manage application and page level context in ionic?
I have researched and found following things:

Application level Context
Use localStorage/sessionStorage to avail the things in the whole application.

Page Level Context
Use life cycles hook to manage variable scoping and other things of the page level.

I am worried about memory leak problem in the application. So how to deal with this problem? Is ionic handle this problem or I have to take care of this.

I would say that your questions are a bit more related to angular as to ionic. And Other parts contained such as RxJS

Maybe also read angular.io stuff?

Sorry I couldn’t get it how RxJS will solve this ?

Hi

With RXJS you can potentially create memory leakages (your question) by not unsubscribing.

So I took your question as a general request. And as Ionic apps generlally use a number of third party libraries (such as RxJS for Observables, Angular, Cordova) so the question can automatically expands beyond Ionic.

Regards

Tom

Thanks Tommertom !!!

I’m not sure what you mean by “sessionStorage”, but any sort of storage is (IMHO) only appropriate for things that you want to persist across app restarts. It should not be used simply to communicate across objects: an ordinary provider is sufficient for that.

1 Like