File changed callback.

pull/1/head
chriseth 8 years ago
parent 0e9930f94f
commit 2c3591a795
  1. 3
      src/app.js
  2. 7
      src/app/file-explorer.js

@ -172,7 +172,7 @@ var run = function () {
var FilePanelAPI = {
createName: createNonClashingName,
switchToFile: switchToFile,
ui: ui.event
event: this.event
}
var el = new FilePanel(FilePanelAPI, files)
filepanel.appendChild(el)
@ -352,6 +352,7 @@ var run = function () {
} else {
editor.open(file, files.get(file))
}
self.event.trigger('currentFileChanged', [file])
}
function switchToNextFile () {

@ -37,7 +37,6 @@ module.exports = fileExplorer
function fileExplorer (appAPI, files) {
var fileEvents = files.event
var appUI = appAPI.ui
var tv = new Treeview({
extractData: function (value, tree, key) {
var newValue = {}
@ -76,10 +75,8 @@ function fileExplorer (appAPI, files) {
</span>
`
appUI.register('fileChanged', (changedFiles) => {
if (changedFiles[0] === 'currentFile') {
fileFocus(files.get('currentFile'))
}
appAPI.event.register('currentFileChanged', (newFile) => {
fileFocus(newFile)
})
fileEvents.register('fileRemoved', fileRemoved)
fileEvents.register('fileRenamed', fileRenamed)

Loading…
Cancel
Save