View backward navigation

Is there a good way to view when a user clicks the back button? Such as an on navigate back?

Just found in documentation. Two separate attributes can be added to the title tag in the view XML.

<view title="title" on-back="$:someFunction()">

or

<view title="title" on-navigate="$:someFunction()">