本文整理汇总了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;
};
}
示例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);
}
示例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();
});
});