Simple Question on wixLocation.onChange()

Hi everyone !!!
I am having a simple question here …

I am having a .jsw file …
In the page code, if I add a wixLocation.onChange() can I run a function in the .jsw file ???

Scenario →
The user is in the page…
When the user clicks a button or go backs, I want to run a function in the .jsw file…

Is it possible ??
Thanks !!!

Any idea ?