Nope, no easy build-in solution. Just like with native apps, you have to do your homework :)
By the way, you have events to help you with that.
beforetransition / aftertransition
Those events are triggered each time you slide from a panel to another.
Or you can directly use transitions attributes to trigger a JS function when sliding between panels
If you look at the Notes app demo
In the code you can see
<section id="note" data-title="Notes App" class="panel" data-onshow="notes.tlbManager()" data-onexit="notes.emptyForm()">
Those really helps to trigger a function at a particular moment on a particular screen
Again, If you don't care about device physical back button & browser's prev/next buttons, are on schedule / budget, you can just create your own backButton & hide Emy's one
<section id="screenA" data-title="Screen A" class="panel" data-hidebackbutton="true">
and put your own button in the toolbar's first div (for the left side) or second div (for the right side)
<a id="mybackbutton" class="button" onclick="myFunction(myVar)">Back</a>
Kind of like the "About" button in the toolbar of the same Notes demo app :)