From d31fff14f2102f7b41d905ad98c48531fa83775d Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 27 Sep 2021 16:43:35 +0200 Subject: [PATCH] async await --- apps/remix-ide/src/app.js | 2 +- apps/remix-ide/src/app/files/fileManager.js | 10 +++++----- apps/remix-ide/src/app/panels/main-view.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 371abcfd8e..42c151dd91 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.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) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 5265885909..616ab15566 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -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') diff --git a/apps/remix-ide/src/app/panels/main-view.js b/apps/remix-ide/src/app/panels/main-view.js index 8a76ee6565..77c3123700 100644 --- a/apps/remix-ide/src/app/panels/main-view.js +++ b/apps/remix-ide/src/app/panels/main-view.js @@ -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()