本文整理汇总了TypeScript中smartq.defer函数的典型用法代码示例。如果您正苦于以下问题:TypeScript defer函数的具体用法?TypeScript defer怎么用?TypeScript defer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了defer函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
export let run = (configArg: INpmtsConfig) => {
let done = q.defer();
let shipString =
'' +
'\n' +
'\n' +
' # # ( )\n' +
' ___#_#___|__\n' +
' _ |____________| _\n' +
' _=====| | | | | |==== _\n' +
' =====| |.---------------------------. | |====\n' +
" <--------------------' . . . . . . . . '--------------/\n" +
' \\ /\n' +
' \\___________________________________________________________/\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n' +
' wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n';
if (process.env.CI) {
console.log(shipString);
plugins.beautylog.success('READY TO SHIP!');
} else {
plugins.beautylog.success('Done!');
}
done.resolve(configArg);
};
示例2: function
export let run = function(configArg: INpmtsConfig) {
let done = q.defer<INpmtsConfig>();
let config = configArg;
if (config.test === true) {
plugins.beautylog.ora.text('now starting tests');
plugins.beautylog.ora.end();
plugins.beautylog.log('ready for tapbuffer:');
if (configArg.testConfig.coverage) {
tap(config)
.then(handleCoverageData)
.then(() => {
done.resolve(config);
})
.catch(err => {
console.log(err);
});
} else {
tap(config)
.then(() => {
done.resolve(config);
})
.catch(err => {
console.log(err);
});
}
} else {
plugins.beautylog.ora.end();
done.resolve(config);
}
return done.promise;
};
示例3:
export let run = (configArg: INpmtsConfig) => {
let done = q.defer();
if (configArg.watch && npmtsSmartchok === null) {
let pathsToWatch: string[] = [];
for (let key in configArg.ts) {
pathsToWatch.push(key);
}
for (let key in configArg.testTs) {
pathsToWatch.push(key);
}
npmtsSmartchok = new smartchok.Smartchok(pathsToWatch);
npmtsSmartchok.getObservableFor('change').then(changeObservableArg => {
plugins.beautylog.info('now watching...');
changeObservableArg.subscribe(() => {
cli.run();
});
});
npmtsSmartchok.start();
done.resolve(configArg);
} else {
plugins.beautylog.info('not watching');
done.resolve(configArg);
}
return done.promise;
};
示例4: ProjectinfoNpm
let checkProjectTypings = (configArg: INpmtsConfig) => {
let done = q.defer<INpmtsConfig>();
plugins.beautylog.ora.text('Check Module: Check Project Typings...');
projectInfo = new ProjectinfoNpm(paths.cwd);
if (typeof projectInfo.packageJson.typings === 'undefined') {
plugins.beautylog.error(`please add typings field to package.json`);
process.exit(1);
}
done.resolve(configArg);
return done.promise;
};
示例5: function
export let run = function(configArg) {
plugins.beautylog.ora.text('cleaning up from previous builds...');
let done = q.defer();
removeDist()
.then(removePages)
.then(function() {
plugins.beautylog.ok('Cleaned up from previous builds!');
done.resolve(configArg);
});
return done.promise;
};
示例6:
.then(configArg => {
let done = q.defer<NpmtsConfig.INpmtsConfig>();
NpmtsMods.modTest
.load()
.then(modTest => {
return modTest.run(configArg);
})
.then(configArg => {
done.resolve(configArg);
});
return done.promise;
})
示例7: function
export let run = function(configArg) {
let done = q.defer();
let config = configArg;
plugins.beautylog.ora.text('now compiling ' + 'TypeScript');
plugins.tsn
.compileGlobStringObject(config.ts, config.tsOptions, paths.cwd)
.then(() => {
plugins.beautylog.ok(`compiled the module's TypeScript!`);
done.resolve(config);
})
.catch(err => {
console.log(err);
});
return done.promise;
};
示例8: function
export let run = function(configArg) {
let done = q.defer();
let config = configArg;
plugins.beautylog.ora.text('now looking at ' + 'required assets');
if (config.cli === true) {
let mainJsPath = projectInfo.packageJson.main;
let cliJsString: string = plugins.smartfile.fs.toStringSync(
plugins.path.join(paths.npmtsAssetsDir, 'cli.js')
);
cliJsString = cliJsString.replace('{{pathToIndex}}', mainJsPath);
plugins.smartfile.memory.toFsSync(cliJsString, plugins.path.join(paths.distDir, 'cli.js'));
plugins.beautylog.ok('installed CLI assets!');
done.resolve(config);
} else {
plugins.beautylog.ok('No additional assets required!');
done.resolve(config);
}
return done.promise;
};