本文整理匯總了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();
});
});