Do not compile while typing.

pull/1/head
Christian 10 years ago committed by chriseth
parent 871e16cf1c
commit 5c07958e8f
  1. 4
      index.html

@ -128,12 +128,14 @@ var compile = function() {
outputArea.innerHTML = "Uncaught JavaScript Exception:\n" + exception; outputArea.innerHTML = "Uncaught JavaScript Exception:\n" + exception;
} }
} }
var compileTimeout = null;
var onChange = function() { var onChange = function() {
var input = editor.getValue(); var input = editor.getValue();
if (input == previousInput) if (input == previousInput)
return; return;
previousInput = input; previousInput = input;
compile(); if (compileTimeout) window.clearTimeout(compileTimeout);
compileTimeout = window.setTimeout(compile, 300);
}; };
editor.getSession().on('change', onChange); editor.getSession().on('change', onChange);

Loading…
Cancel
Save