mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(dom) loadCurrentSize: callback -> promise
This commit is contained in:
parent
462d7bf3b5
commit
4e86f7f308
2 changed files with 8 additions and 8 deletions
|
|
@ -225,7 +225,7 @@ function CmdProto() {
|
|||
* get size
|
||||
* @currentFile
|
||||
*/
|
||||
this.loadCurrentSize = callbackify(async (currentFile) => {
|
||||
this.loadCurrentSize = async (currentFile) => {
|
||||
const current = currentFile || DOM.getCurrentFile();
|
||||
const query = '?size';
|
||||
const link = DOM.getCurrentPath(current);
|
||||
|
|
@ -241,7 +241,7 @@ function CmdProto() {
|
|||
Images.hide();
|
||||
|
||||
return current;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* load hash
|
||||
|
|
|
|||
|
|
@ -281,18 +281,18 @@ async function switchKey(event) {
|
|||
break;
|
||||
|
||||
case KEY.SPACE:
|
||||
event.preventDefault();
|
||||
|
||||
if (!isDir || name === '..')
|
||||
isSelected = true;
|
||||
else
|
||||
isSelected = DOM.isSelected(current);
|
||||
|
||||
exec.if(isSelected, () => {
|
||||
DOM.toggleSelectedFile(current);
|
||||
}, (callback) => {
|
||||
DOM.loadCurrentSize(current, callback);
|
||||
});
|
||||
if (!isSelected)
|
||||
await DOM.loadCurrentSize(current);
|
||||
|
||||
DOM.toggleSelectedFile(current);
|
||||
|
||||
event.preventDefault();
|
||||
break;
|
||||
|
||||
case KEY.U:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue