mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 10:38:26 +00:00
refactor(load-remote) wraptile
This commit is contained in:
parent
040b45394a
commit
71c65d7354
1 changed files with 11 additions and 11 deletions
|
|
@ -5,11 +5,15 @@
|
|||
const exec = require('execon');
|
||||
const rendy = require('rendy/legacy');
|
||||
const itype = require('itype/legacy');
|
||||
const wraptile = require('wraptile/legacy');
|
||||
|
||||
const {findObjByNameInArr} = require('../../common/util');
|
||||
|
||||
const load = require('./load');
|
||||
const Files = require('./files');
|
||||
|
||||
const parallel = wraptile(load.parallel);
|
||||
|
||||
module.exports = (name, options, callback = options) => {
|
||||
const {PREFIX, config} = CloudCmd;
|
||||
const o = options;
|
||||
|
|
@ -51,19 +55,15 @@ module.exports = (name, options, callback = options) => {
|
|||
};
|
||||
|
||||
function funcOFF(local, callback) {
|
||||
return () => {
|
||||
load.parallel(local, callback);
|
||||
};
|
||||
return parallel(local, callback);
|
||||
}
|
||||
|
||||
function funcON (local, remote,callback) {
|
||||
return () => {
|
||||
load.parallel(remote, (error) => {
|
||||
if (error)
|
||||
return funcOFF();
|
||||
|
||||
callback();
|
||||
});
|
||||
};
|
||||
return parallel(remote, (error) => {
|
||||
if (error)
|
||||
return funcOFF();
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue