Javascript pause - disable a function until another one finishes

Viewed 1498

I have two functions, first one selects stuff and the other evaluates it with a delay, like this:

function select() {
    // selecting stuff
    window.setTimeout(evaluate, 1000);
}
function evaluate() {
    // evaluating stuff
}

The issue is, the selecting function should be disabled until the second is done. I know it's impossible to completely pause Javascript, but the first function firing while the other one is waiting or working seriously messes everything up. I already tried moving code around to other functions and delaying those, but nothing works.

Thanks in advance!

3 Answers
Related