Commit 2c3591a7 authored by chriseth's avatar chriseth

File changed callback.

parent 0e9930f9
......@@ -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)
......
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