本文整理汇总了TypeScript中clui.Spinner.start方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Spinner.start方法的具体用法?TypeScript Spinner.start怎么用?TypeScript Spinner.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clui.Spinner
的用法示例。
在下文中一共展示了Spinner.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: return
return (() => {
let [platform, version] = platformParam.split("@");
this.validatePlatform(platform);
let platformPath = path.join(this.$projectData.platformsDir, platform);
if (this.$fs.exists(platformPath).wait()) {
this.$errors.failWithoutHelp("Platform %s already added", platform);
}
let platformData = this.$platformsData.getPlatformData(platform);
// Copy platform specific files in platforms dir
let platformProjectService = platformData.platformProjectService;
platformProjectService.validate().wait();
// Log the values for project
this.$logger.trace("Creating NativeScript project for the %s platform", platform);
this.$logger.trace("Path: %s", platformData.projectRoot);
this.$logger.trace("Package: %s", this.$projectData.projectId);
this.$logger.trace("Name: %s", this.$projectData.projectName);
this.$logger.out("Copying template files...");
let packageToInstall = "";
let npmOptions: IStringDictionary = {
pathToSave: path.join(this.$projectData.platformsDir, platform)
};
if (this.$options.frameworkPath) {
packageToInstall = this.$options.frameworkPath;
} else {
packageToInstall = platformData.frameworkPackageName;
npmOptions["version"] = version;
}
let spinner = new clui.Spinner("Installing " + packageToInstall);
try {
spinner.start();
let downloadedPackagePath = this.$npmInstallationManager.install(packageToInstall, npmOptions).wait();
let frameworkDir = path.join(downloadedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME);
frameworkDir = path.resolve(frameworkDir);
this.addPlatformCore(platformData, frameworkDir).wait();
} catch (err) {
this.$fs.deleteDirectory(platformPath).wait();
throw err;
} finally {
spinner.stop();
}
this.$logger.out("Project successfully created.");
}).future<void>()();
示例2: Progress
// Sparkline
const reqsPerSec = [10, 12, 3, 7, 12, 9, 23, 10, 9, 19, 16, 18, 12, 12];
console.log(Sparkline(reqsPerSec, 'reqs/sec'));
// Progress
const thisProgressBar = new Progress(20);
console.log(thisProgressBar.update(10, 30));
// or
const thisPercentBar = new Progress(20);
console.log(thisPercentBar.update(0.4));
// Spinner
const countdown = new Spinner('Exiting in 10 seconds... ', ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷']);
countdown.start();
let n = 10;
const interval = setInterval(() => {
n--;
countdown.message(`Exiting in ${n} seconds...`);
if (n === 0) {
console.log('\n');
countdown.stop();
clearInterval(interval);
}
}, 1000);