async await

pull/1622/head
filip mertens 3 years ago
parent 613395f79d
commit d31fff14f2
  1. 2
      apps/remix-ide/src/app.js
  2. 10
      apps/remix-ide/src/app/files/fileManager.js
  3. 4
      apps/remix-ide/src/app/panels/main-view.js

@ -256,7 +256,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// ----------------- editor service ----------------------------
const editor = new Editor({}, themeModule) // wrapper around ace editor
registry.put({ api: editor, name: 'editor' })
editor.event.register('requiringToSaveCurrentfile', () => fileManager.saveCurrentFile())
editor.event.register('requiringToSaveCurrentfile', async () => await fileManager.saveCurrentFile())
// ----------------- fileManager service ----------------------------
const fileManager = new FileManager(editor, appManager)

@ -601,8 +601,8 @@ class FileManager extends Plugin {
this.openFile()
}
unselectCurrentFile () {
this.saveCurrentFile()
async unselectCurrentFile () {
await this.saveCurrentFile()
this._deps.config.set('currentFile', '')
// TODO: Only keep `this.emit` (issue#2210)
this.emit('noFileSelected')
@ -614,7 +614,7 @@ class FileManager extends Plugin {
this.emit('noFileSelected')
this.events.emit('noFileSelected')
} else {
this.saveCurrentFile()
await this.saveCurrentFile()
const resolved = this.getPathFromUrl(file)
file = resolved.file
const provider = resolved.provider
@ -707,14 +707,14 @@ class FileManager extends Plugin {
return this.appManager.isActive('remixd')
}
saveCurrentFile () {
async saveCurrentFile () {
var currentFile = this._deps.config.get('currentFile')
if (currentFile && this.editor.current()) {
var input = this.editor.get(currentFile)
if ((input !== null) && (input !== undefined)) {
var provider = this.fileProviderOf(currentFile)
if (provider) {
provider.set(currentFile, input)
await provider.set(currentFile, input)
this.emit('fileSaved', currentFile)
} else {
console.log('cannot save ' + currentFile + '. Does not belong to any explorer')

@ -35,8 +35,8 @@ export class MainView {
this.init()
}
showApp (name) {
this.fileManager.unselectCurrentFile()
async showApp (name) {
await this.fileManager.unselectCurrentFile()
this.mainPanel.showContent(name)
this._view.editor.style.display = 'none'
this._components.contextView.hide()

Loading…
Cancel
Save