You should update only if anything in the model changes.
|
window.onkeydown = function(e) { |
|
if(e.which == 113) { //F2 |
|
window.convert(); |
|
return false; |
|
} |
|
if (!autoUpdate) { |
|
return true; |
|
} |
|
if(timeout) { |
|
clearTimeout(timeout); |
|
timeout = null; |
|
} |
|
timeout = setTimeout(() => { |
|
convert() |
|
}, 2000) |
|
} |