當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fibers類代碼示例

本文整理匯總了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;未經允許,請勿轉載。