Merge pull request #292 from ethereum/periodic-save

Save file contents periodically
pull/1/head
yann300 8 years ago committed by GitHub
commit a247dd00c3
  1. 26
      src/app.js
  2. 6
      src/app/compiler.js

@ -452,18 +452,32 @@ var run = function () {
var previousInput = ''
var compileTimeout = null
var saveTimeout = null
function editorOnChange () {
var input = editor.getValue()
if (input === '') {
editor.setCacheFileContent('')
return
}
// if there's no change, don't do anything
if (input === previousInput) {
return
}
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) {
return
}
@ -508,6 +522,10 @@ var run = function () {
}
})
compiler.event.register('compilationStarted', this, function () {
editor.clearAnnotations()
})
function startdebugging (txHash) {
transactionDebugger.debug(txHash)
selectTab($('ul#options li.debugView'))

@ -37,15 +37,13 @@ function Compiler (editor, handleGithubCall) {
})
}
var compile = function (missingInputs) {
editor.clearAnnotations()
var compile = function () {
self.event.trigger('compilationStarted', [])
var input = editor.getValue()
editor.setCacheFileContent(input)
var files = {}
files[utils.fileNameFromKey(editor.getCacheFile())] = input
internalCompile(files, missingInputs)
internalCompile(files)
}
this.compile = compile

Loading…
Cancel
Save