本文整理汇总了TypeScript中fibers类的典型用法代码示例。如果您正苦于以下问题:TypeScript fibers类的具体用法?TypeScript fibers怎么用?TypeScript fibers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fibers类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: _exec
/** */
_exec( args, done: ( err: boolean ) => void ) {
try {
const fn = fibers( () => this.exec( args, done ) );
fn.run();
} catch ( err ) {
if ( err )
this.error( "Throwed error:" + err.toString() );
done( true );
}
}
开发者ID:hleclerc,项目名称:nsmake,代码行数:11,代码来源:TaskFiber.ts
示例2: require
// this call must be first to avoid requiring c++ dependencies
require("./common/verify-node-version").verifyNodeVersion(node, "NativeScript", "2.2.0");
require("./bootstrap");
import * as fiber from "fibers";
import Future = require("fibers/future");
import * as shelljs from "shelljs";
shelljs.config.silent = true;
import {installUncaughtExceptionListener} from "./common/errors";
installUncaughtExceptionListener(process.exit);
fiber(() => {
let config: Config.IConfig = $injector.resolve("$config");
let err: IErrors = $injector.resolve("$errors");
err.printCallStack = config.DEBUG;
let commandDispatcher: ICommandDispatcher = $injector.resolve("commandDispatcher");
let messages: IMessagesService = $injector.resolve("$messagesService");
messages.pathsToMessageJsonFiles = [/* Place client-specific json message file paths here */];
if (process.argv[2] === "completion") {
commandDispatcher.completeCommand().wait();
} else {
commandDispatcher.dispatchCommand().wait();
}
$injector.dispose();
Future.assertNoFutureLeftBehind();
}).run();
开发者ID:Emat12,项目名称:nativescript-cli,代码行数:30,代码来源:nativescript-cli.ts
示例3: run
export function run(action: any) {
if(fiber.current) {
// Use the already existing fiber, we do not need new one.
action();
} else {
fiber(() => {
action();
// Call dispose method of $injector modules, which implement IDisposable.
$injector.dispose();
Future.assertNoFutureLeftBehind();
}).run();
}
}
开发者ID:enchev,项目名称:mobile-cli-lib,代码行数:13,代码来源:fiber-bootstrap.ts
注:本文中的fibers类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论