From ca0bcc5a551afca258c798ec318f88c1a9e38f5c Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 1 Nov 2016 21:17:53 +0000 Subject: [PATCH] Move editor.getValue from compiler to app --- src/app.js | 7 ++++++- src/app/compiler.js | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app.js b/src/app.js index 7a43d795a2..1b26a4dbd6 100644 --- a/src/app.js +++ b/src/app.js @@ -518,7 +518,12 @@ var run = function () { if (compileTimeout) { window.clearTimeout(compileTimeout) } - compileTimeout = window.setTimeout(compiler.compile, 300) + compileTimeout = window.setTimeout(function () { + var files = {} + files[utils.fileNameFromKey(editor.getCacheFile())] = editor.getValue() + + compiler.compile(files) + }, 300) } editor.onChangeSetup(editorOnChange) diff --git a/src/app/compiler.js b/src/app/compiler.js index f3b447983b..446903a7d6 100644 --- a/src/app/compiler.js +++ b/src/app/compiler.js @@ -39,12 +39,8 @@ function Compiler (editor, handleImportCall) { }) } - var compile = function () { + var compile = function (files) { self.event.trigger('compilationStarted', []) - var input = editor.getValue() - - var files = {} - files[utils.fileNameFromKey(editor.getCacheFile())] = input internalCompile(files) } this.compile = compile