Merge pull request #601 from ethereum/addPluginApi

FileManager: emit fileSaved and fileAdded
pull/603/head
yann300 4 years ago committed by GitHub
commit b8dabed841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      apps/remix-ide/src/app/files/fileManager.js

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

Loading…
Cancel
Save