Unverified Commit b8dabed8 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #601 from ethereum/addPluginApi

FileManager: emit fileSaved and fileAdded
parents 887e76e9 5b2dc6c1
...@@ -158,7 +158,9 @@ class FileManager extends Plugin { ...@@ -158,7 +158,9 @@ class FileManager extends Plugin {
await this._handleIsFile(path, `Cannot write file ${path}`) await this._handleIsFile(path, `Cannot write file ${path}`)
return await this.setFileContent(path, data) return await this.setFileContent(path, data)
} else { } else {
return await this.setFileContent(path, data) const ret = await this.setFileContent(path, data)
this.emit('fileAdded', path)
return ret
} }
} }
...@@ -396,6 +398,7 @@ class FileManager extends Plugin { ...@@ -396,6 +398,7 @@ class FileManager extends Plugin {
provider.set(path, content, (error) => { provider.set(path, content, (error) => {
if (error) reject(error) if (error) reject(error)
this.syncEditor(path) this.syncEditor(path)
this.emit('fileSaved', path)
resolve(true) resolve(true)
}) })
}) })
...@@ -528,6 +531,7 @@ class FileManager extends Plugin { ...@@ -528,6 +531,7 @@ class FileManager extends Plugin {
var provider = this.fileProviderOf(currentFile) var provider = this.fileProviderOf(currentFile)
if (provider) { if (provider) {
provider.set(currentFile, input) provider.set(currentFile, input)
this.emit('fileSaved', currentFile)
} else { } else {
console.log('cannot save ' + currentFile + '. Does not belong to any explorer') console.log('cannot save ' + currentFile + '. Does not belong to any explorer')
} }
......
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