From 5c07958e8f2b6044a0ce5ed3d192f9d107517362 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 27 Nov 2014 00:22:45 +0100 Subject: [PATCH] Do not compile while typing. --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 06fd0c1bc6..ddef710d4a 100644 --- a/index.html +++ b/index.html @@ -128,12 +128,14 @@ var compile = function() { outputArea.innerHTML = "Uncaught JavaScript Exception:\n" + exception; } } +var compileTimeout = null; var onChange = function() { var input = editor.getValue(); if (input == previousInput) return; previousInput = input; - compile(); + if (compileTimeout) window.clearTimeout(compileTimeout); + compileTimeout = window.setTimeout(compile, 300); }; editor.getSession().on('change', onChange);