diff --git a/client/modules/operation/index.mjs b/client/modules/operation/index.mjs index 555433f6..48b6fa02 100644 --- a/client/modules/operation/index.mjs +++ b/client/modules/operation/index.mjs @@ -6,7 +6,7 @@ import load from 'load.js'; import {tryToCatch} from 'try-to-catch'; import {encode} from '../../../common/entity.js'; import removeExtension from './remove-extension.js'; -import setListeners from './set-listeners.js'; +import {setListeners} from './set-listeners.mjs'; import getNextCurrentName from './get-next-current-name.js'; const {DOM, CloudCmd} = globalThis; diff --git a/client/modules/operation/set-listeners.js b/client/modules/operation/set-listeners.mjs similarity index 86% rename from client/modules/operation/set-listeners.js rename to client/modules/operation/set-listeners.mjs index 495cd04b..f9785ca2 100644 --- a/client/modules/operation/set-listeners.js +++ b/client/modules/operation/set-listeners.mjs @@ -1,14 +1,11 @@ -'use strict'; - /* global DOM */ -const forEachKey = require('for-each-key'); - -const wraptile = require('wraptile'); -const format = require('./format'); +import forEachKey from 'for-each-key'; +import wraptile from 'wraptile'; +import format from './format.js'; const {Dialog, Images} = DOM; -module.exports = (options) => (emitter) => { +export const setListeners = (options) => (emitter) => { const { operation, callback, @@ -43,10 +40,12 @@ module.exports = (options) => (emitter) => { operation, })); + let noProgress = true; const listeners = { progress: (value) => { done = value === 100; progress.setProgress(value); + noProgress = false; }, end: () => { @@ -54,7 +53,7 @@ module.exports = (options) => (emitter) => { forEachKey(removeListener, listeners); progress.remove(); - if (lastError || done) + if (lastError || done || noProgress) callback(); },