Invoke a function when page is returned

I basically have two pages. One main page, and then second page.
When I press button A on main page, it invokes the following:
this.navCtrl.push(SecondPage);
And then second page has a back button that will return to main page.
I need to update some values whenever the back button is pressed or if navCtrl returns to main page. The function is found on main page ts. What can be done for this?