Added onBeforeChange callback

This PR allows the developer to bind custom callbacks to be called before the change event occurs.