Files
now-deployment/node_modules/now/dist/util/with-spinner.ts
2019-10-17 12:36:15 +09:00

14 lines
281 B
TypeScript

import wait from './output/wait';
export default async function withSpinner<T>(msg: string, f: () => Promise<T>) {
const stopSpinner = wait(msg);
try {
const res = await f();
stopSpinner();
return res;
} catch (error) {
stopSpinner();
throw error;
}
}