本文整理匯總了TypeScript中@es-git/terminal.log函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript log函數的具體用法?TypeScript log怎麽用?TypeScript log使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了log函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: eventChannel
export default function* withProgress<T>(terminal : Terminal, start : (emit : (v : string) => void) => Promise<T>){
const channel = yield eventChannel(emit => {
start(throttle(200, emit)).then(emit, emit);
return () => {};
});
while(true){
const message : StringOrResult = yield take(channel);
if(typeof(message) === 'string'){
yield put(gitProgressMessage(terminal.log(message)));
}else{
return message;
}
}
}
示例2: push
function* push(user : OauthData, components : string[]){
var terminal = new Terminal();
try{
yield put(gitProgressStatus('busy'));
yield put(gitProgressMessage(terminal.logLine(`Pushing...`)));
yield put(showPopup('GitProgress'));
yield* withProgress(terminal, emit => storage.push(user, components, emit));
yield put(gitProgressStatus('success'));
yield put(hidePopup());
}catch(e){
terminal.logLine();
yield put(gitProgressStatus('failure'));
yield put(gitProgressMessage(terminal.log(e.message)));
console.error(e);
}
}
示例3: fetch
function* fetch(){
var terminal = new Terminal();
try{
yield put(gitProgressStatus('busy'));
yield put(gitProgressMessage(terminal.logLine(`Fetching...`)));
yield put(showPopup('GitProgress'));
yield* withProgress(terminal, emit => storage.fetch(emit));
yield put(gitProgressStatus('success'));
yield put(hidePopup());
}catch(e){
terminal.logLine();
yield put(gitProgressStatus('failure'));
yield put(gitProgressMessage(terminal.log(e.message)));
console.error(e);
}
}
示例4: pull
function* pull(repo : string, name : string, hash? : string){
var terminal = new Terminal();
try{
yield put(gitProgressStatus('busy'));
yield put(gitProgressMessage(terminal.logLine(`Loading ${name}\nfrom ${repo}`)));
yield put(showPopup('GitProgress'));
yield* fetchWithProgress(repo, name, hash, terminal);
yield put(gitProgressStatus('success'));
yield put(hidePopup());
return yield storage.load(repo, name, hash);
}catch(e){
terminal.logLine();
yield put(gitProgressStatus('failure'));
yield put(gitProgressMessage(terminal.log(e.message)));
throw e;
}
}
示例5:
await repo.push(`/proxy/${url}.git`, 'refs/heads/master', user, { progress: message => terminal.log(message) })