Event that got called only once during first visit?


#1

Is there any event that will got called only once during first visit and if not, how to make such a event myself?


#2

Do you mean “visit of a page”? Then you should use Lifecycle Events.

Lifecycle Events are explained here:

You could combine it with a custom provider with methods like getVisitCount(page) and addVisitCount(page), to check, if it is the first navigation to the page.


#3

if first visit after app install . you can use storage to save this


#4

I just want to seed home page with some initial data only once during the first load when user log in.


#5

The you should use vks_gautam1s suggestion.
You need to persist the state, if the user logged in before or not. If not and the user restarts the app, the state would be reseted.

Create a Provider for reading and writing for example a key “visited” as boolean to storage and add methods setVisited and getVisited. When your app starts, you read the visited value from your storage and cache it inside the provider. then, after a login you check your visited variable. If it is true, you navigate to your other page. If it is false, you navigate to your HomePage and write the visited key with your provider to the value “true”.

Here is a description for a possible storage:

You could also change preferences for that use case, if you use cordova: