Commit a247dd00 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #292 from ethereum/periodic-save

Save file contents periodically
parents ec1ab032 a9da67aa
...@@ -452,18 +452,32 @@ var run = function () { ...@@ -452,18 +452,32 @@ var run = function () {
var previousInput = '' var previousInput = ''
var compileTimeout = null var compileTimeout = null
var saveTimeout = null
function editorOnChange () { function editorOnChange () {
var input = editor.getValue() var input = editor.getValue()
if (input === '') {
editor.setCacheFileContent('') // if there's no change, don't do anything
return
}
if (input === previousInput) { if (input === previousInput) {
return return
} }
previousInput = input previousInput = input
// fire storage update
// NOTE: save at most once per 5 seconds
if (saveTimeout) {
window.clearTimeout(saveTimeout)
}
saveTimeout = window.setTimeout(function () {
var input = editor.getValue()
editor.setCacheFileContent(input)
}, 5000)
// special case: there's nothing else to do
if (input === '') {
return
}
if (!autoCompile) { if (!autoCompile) {
return return
} }
...@@ -508,6 +522,10 @@ var run = function () { ...@@ -508,6 +522,10 @@ var run = function () {
} }
}) })
compiler.event.register('compilationStarted', this, function () {
editor.clearAnnotations()
})
function startdebugging (txHash) { function startdebugging (txHash) {
transactionDebugger.debug(txHash) transactionDebugger.debug(txHash)
selectTab($('ul#options li.debugView')) selectTab($('ul#options li.debugView'))
......
...@@ -37,15 +37,13 @@ function Compiler (editor, handleGithubCall) { ...@@ -37,15 +37,13 @@ function Compiler (editor, handleGithubCall) {
}) })
} }
var compile = function (missingInputs) { var compile = function () {
editor.clearAnnotations()
self.event.trigger('compilationStarted', []) self.event.trigger('compilationStarted', [])
var input = editor.getValue() var input = editor.getValue()
editor.setCacheFileContent(input)
var files = {} var files = {}
files[utils.fileNameFromKey(editor.getCacheFile())] = input files[utils.fileNameFromKey(editor.getCacheFile())] = input
internalCompile(files, missingInputs) internalCompile(files)
} }
this.compile = compile this.compile = compile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment