Merge pull request #427 from ethereum/sync-on-switch

Sync file on tab switch
pull/1/head
chriseth 8 years ago committed by GitHub
commit 44091ec287
  1. 12
      src/app.js

@ -299,6 +299,8 @@ var run = function () {
editor.event.register('sessionSwitched', refreshTabs)
function switchToFile (file) {
editorSyncFile()
currentFile = file
if (files.isReadOnly(file)) {
@ -659,6 +661,11 @@ var run = function () {
compiler.compile(files, target)
}
function editorSyncFile () {
var input = editor.get(currentFile)
files.set(currentFile, input)
}
var previousInput = ''
var compileTimeout = null
var saveTimeout = null
@ -677,10 +684,7 @@ var run = function () {
if (saveTimeout) {
window.clearTimeout(saveTimeout)
}
saveTimeout = window.setTimeout(function () {
var input = editor.get(currentFile)
files.set(currentFile, input)
}, 5000)
saveTimeout = window.setTimeout(editorSyncFile, 5000)
// special case: there's nothing else to do
if (input === '') {

Loading…
Cancel
Save