Viewer API: use of resetToSessionValue for CANCEL button

We coded an APPLY button that triggers the customize() function.
Now we would like to use resetToSessionValue for a CANCEL button.
There is some straight way to reset all parameters or we need a loop that takes parameter by parameter and resets every one?