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


TypeScript cp.Client.getService方法代碼示例

本文整理匯總了TypeScript中vs/base/node/service.cp.Client.getService方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript cp.Client.getService方法的具體用法?TypeScript cp.Client.getService怎麽用?TypeScript cp.Client.getService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vs/base/node/service.cp.Client的用法示例。


在下文中一共展示了cp.Client.getService方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: startWatching

	public startWatching(): () => void /* dispose */ {
		const client = new Client(
			uri.parse(require.toUrl('bootstrap')).fsPath,
			{
				serverName: 'Watcher',
				args: ['--type=watcherService'],
				env: {
					AMD_ENTRYPOINT: 'vs/workbench/services/files/node/watcher/unix/watcherApp',
					PIPE_LOGGING: 'true',
					VERBOSE_LOGGING: this.verboseLogging
				}
			}
		);

		const service = client.getService<WatcherService>('WatcherService', WatcherService);

		// Start watching
		service.watch({ basePath: this.basePath, ignored: this.ignored, verboseLogging: this.verboseLogging }).then(null, (err) => {
			if (!(err instanceof Error && err.name === 'Canceled' && err.message === 'Canceled')) {
				return TPromise.wrapError(err); // the service lib uses the promise cancel error to indicate the process died, we do not want to bubble this up
			}
		}, (events: IRawFileChange[]) => this.onRawFileEvents(events)).done(() => {

			// our watcher app should never be completed because it keeps on watching. being in here indicates
			// that the watcher process died and we want to restart it here.
			if (!this.isDisposed) {
				this.startWatching();
			}
		}, this.errorLogger);

		return () => {
			client.dispose();
			this.isDisposed = true;
		};
	}
開發者ID:BMGburger,項目名稱:vscode,代碼行數:35,代碼來源:watcherService.ts

示例2: createService

function createService() {
	const server = new Client(
		uri.parse(require.toUrl('bootstrap')).fsPath,
		{
			serverName: 'TestServer',
			env: { AMD_ENTRYPOINT: 'vs/base/test/node/service/testApp', verbose: true }
		}
	);

	return server.getService<TestService>('TestService', TestService);
}
開發者ID:1424667164,項目名稱:vscode,代碼行數:11,代碼來源:service.test.ts

示例3: test

	test('createService', function(done: () => void) {
		this.timeout(5000);

		const server = new Client(
			uri.parse(require.toUrl('bootstrap')).fsPath,
			{
				serverName: 'TestServer',
				env: { AMD_ENTRYPOINT: 'vs/base/test/node/service/testApp', verbose: true }
			}
		);

		const testService = server.getService<TestService>('TestService', TestService);
		const res = testService.pong('ping');

		res.then(r => {
			assert.equal(r.incoming, 'ping');
			assert.equal(r.outgoing, 'pong');
			done();
		});
	});
開發者ID:gaoxiaojun,項目名稱:vscode,代碼行數:20,代碼來源:service.test.ts


注:本文中的vs/base/node/service.cp.Client.getService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。