本文整理汇总了TypeScript中vs/base/common/async.always函数的典型用法代码示例。如果您正苦于以下问题:TypeScript always函数的具体用法?TypeScript always怎么用?TypeScript always使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了always函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('event dispose', () => {
if (process.env['VSCODE_PID']) {
return undefined; // this test fails when run from within VS Code
}
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
let count = 0;
const disposable = service.onMarco(() => count++);
const result = service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 1);
return service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 2);
disposable.dispose();
return service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 2);
});
});
});
return always(result, () => client.dispose());
});
开发者ID:AllureFer,项目名称:vscode,代码行数:30,代码来源:ipc.test.ts
示例2: test
test('increasing raw data size', () => {
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
const runs = [
{ batches: 250000, dataSize: 100 },
{ batches: 25000, dataSize: 1000 },
{ batches: 2500, dataSize: 10000 },
{ batches: 1250, dataSize: 20000 },
{ batches: 500, dataSize: 50000 },
{ batches: 250, dataSize: 100000 },
{ batches: 125, dataSize: 200000 },
{ batches: 50, dataSize: 500000 },
{ batches: 25, dataSize: 1000000 },
];
let i = 0;
const result = measure(service, 10, 10, 250) // warm-up
.then(() => {
return (function nextRun() {
if (i >= runs.length) {
return;
}
const run = runs[i++];
return measure(service, run.batches, 1, run.dataSize)
.then(() => {
return nextRun();
});
})();
});
return always(result, () => client.dispose());
});
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:33,代码来源:ipc.perf.ts
示例3: test
test('event dispose', () => {
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
let count = 0;
const disposable = service.onMarco(() => count++);
const result = service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 1);
return service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 2);
disposable.dispose();
return service.marco().then(answer => {
assert.equal(answer, 'polo');
assert.equal(count, 2);
});
});
});
return always(result, () => client.dispose());
});
开发者ID:developers23,项目名称:vscode,代码行数:26,代码来源:ipc.test.ts
示例4: test
test('createChannel', () => {
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
const result = service.pong('ping').then(r => {
assert.equal(r.incoming, 'ping');
assert.equal(r.outgoing, 'pong');
});
return always(result, () => client.dispose());
});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:12,代码来源:ipc.cp.test.ts
示例5: test
test('increasing batch size', () => {
if (process.env['VSCODE_PID']) {
return; // TODO@Ben find out why test fails when run from within VS Code
}
const client = createClient();
const channel = client.getChannel<ITestChannel>('test');
const service = new TestServiceClient(channel);
const runs = [
{ batches: 250000, size: 1 },
{ batches: 2500, size: 100 },
{ batches: 500, size: 500 },
{ batches: 250, size: 1000 },
{ batches: 50, size: 5000 },
{ batches: 25, size: 10000 },
// { batches: 10, size: 25000 },
// { batches: 5, size: 50000 },
// { batches: 1, size: 250000 },
];
const dataSizes = [
100,
250,
];
let i = 0, j = 0;
const result = measure(service, 10, 10, 250) // warm-up
.then(() => {
return (function nextRun() {
if (i >= runs.length) {
if (++j >= dataSizes.length) {
return;
}
i = 0;
}
const run = runs[i++];
return measure(service, run.batches, run.size, dataSizes[j])
.then(() => {
return nextRun();
});
})();
});
return always(result, () => client.dispose());
});
开发者ID:1Hgm,项目名称:vscode,代码行数:44,代码来源:ipc.perf.ts
注:本文中的vs/base/common/async.always函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论