If you unbind your buttons to avoid multi-calling of the function, why didn't you define a global boolean variable like inProcess
.
You check if it was true
or false
in the beginning of your function and it's done!
Like this :
var inProcess = false;
function myFunction() {
if (!inProcess) {
inProcess = true;
// some logic code here
inProcess = false;
}
return;
}
It's almost the same process, but, it's lighter for your browser than "bind"/"unbind" multiple time.