Add comments to editor calls

pull/1/head
Alex Beregszaszi 8 years ago
parent e8dbc8e2b1
commit fc98e42bbf
  1. 7
      src/app.js

@ -42,6 +42,7 @@ var run = function () {
var storage = new Storage() var storage = new Storage()
var config = new Config(storage) var config = new Config(storage)
// Add files received from remote instance (i.e. another browser-solidity)
function loadFiles (files) { function loadFiles (files) {
for (var f in files) { for (var f in files) {
storage.loadFile(f, files[f].content) storage.loadFile(f, files[f].content)
@ -51,10 +52,12 @@ var run = function () {
updateFiles() updateFiles()
} }
// Replace early callback with instant response
loadFilesCallback = function (files) { loadFilesCallback = function (files) {
loadFiles(files) loadFiles(files)
} }
// Run if we did receive an event from remote instance while starting up
if (filesToLoad !== null) { if (filesToLoad !== null) {
loadFiles(filesToLoad) loadFiles(filesToLoad)
} }
@ -216,8 +219,10 @@ var run = function () {
}) })
}) })
// Switch tab
$filesEl.on('click', '.file:not(.active)', showFileHandler) $filesEl.on('click', '.file:not(.active)', showFileHandler)
// Edit name of current tab
$filesEl.on('click', '.file.active', function (ev) { $filesEl.on('click', '.file.active', function (ev) {
var $fileTabEl = $(this) var $fileTabEl = $(this)
var originalName = $fileTabEl.find('.name').text() var originalName = $fileTabEl.find('.name').text()
@ -253,6 +258,7 @@ var run = function () {
return false return false
}) })
// Remove current tab
$filesEl.on('click', '.file .remove', function (ev) { $filesEl.on('click', '.file .remove', function (ev) {
ev.preventDefault() ev.preventDefault()
var name = $(this).parent().find('.name').text() var name = $(this).parent().find('.name').text()
@ -277,6 +283,7 @@ var run = function () {
return false return false
} }
// Synchronise tab list with file names known to the editor
function updateFiles () { function updateFiles () {
var $filesEl = $('#files') var $filesEl = $('#files')
var files = editor.getFiles() var files = editor.getFiles()

Loading…
Cancel
Save