本文整理汇总了TypeScript中rxjs/operators.mergeAll函数的典型用法代码示例。如果您正苦于以下问题:TypeScript mergeAll函数的具体用法?TypeScript mergeAll怎么用?TypeScript mergeAll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mergeAll函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should execute lazy HTTP request when listening to response stream', function(done) {
function main(_sources: {HTTP: HTTPSource}) {
return {
HTTP: of({
url: uri + '/pet',
method: 'POST',
send: {name: 'Woof', species: 'Dog'},
lazy: true,
}),
};
}
const {sources, run} = setup(main, {HTTP: makeHTTPDriver()});
globalSandbox.petPOSTResponse = null;
sources.HTTP.select()
.pipe(mergeAll())
.subscribe();
run();
setTimeout(function() {
assert.notStrictEqual(globalSandbox.petPOSTResponse, null);
assert.strictEqual(globalSandbox.petPOSTResponse, 'added Woof the Dog');
globalSandbox.petPOSTResponse = null;
done();
}, 250);
});
开发者ID:,项目名称:,代码行数:28,代码来源:
示例2: windowCount1
windowCount1() {
// emit every 1s
const source = interval(1000);
const example = source.pipe(
// start new window every 4 emitted values
windowCount(4),
tap(_ => console.log('NEW WINDOW!'))
);
const subscribeTwo = example
.pipe(
// window emits nested observable
mergeAll()
/*
output:
"NEW WINDOW!"
0
1
2
3
"NEW WINDOW!"
4
5
6
7
*/
)
.subscribe(val => console.log(val));
}
开发者ID:zwvista,项目名称:SampleMisc,代码行数:29,代码来源:transforming.service.ts
示例3: condaEnvsObservable
export function condaEnvsObservable(condaInfo$: Observable<CondaInfoJSON>) {
return condaInfo$.pipe(
map(info => {
const envs = info.envs.map((env: string) => ({
name: path.basename(env),
prefix: env
}));
envs.push({ name: "root", prefix: info.root_prefix });
return envs;
}),
map(envs => envs.map(ipyKernelTryObservable)),
mergeAll(),
mergeAll(),
toArray()
);
}
开发者ID:nteract,项目名称:nteract,代码行数:16,代码来源:kernels.ts
示例4: windowTime1
windowTime1() {
// emit immediately then every 1s
const source = timer(0, 1000);
const example = source.pipe(
// start new window every 3s
windowTime(3000),
tap(_ => console.log('NEW WINDOW!'))
);
const subscribeTwo = example
.pipe(
// window emits nested observable
mergeAll()
/*
output:
"NEW WINDOW!"
0
1
2
"NEW WINDOW!"
3
4
5
*/
)
.subscribe(val => console.log(val));
}
开发者ID:zwvista,项目名称:SampleMisc,代码行数:27,代码来源:transforming.service.ts
示例5: windowWhen1
windowWhen1() {
// emit immediately then every 1s
const source = timer(0, 1000);
const example = source.pipe(
// close window every 5s and emit observable of collected values from source
windowWhen(() => interval(5000)),
tap(_ => console.log('NEW WINDOW!'))
);
const subscribeTwo = example
.pipe(
// window emits nested observable
mergeAll()
/*
output:
"NEW WINDOW!"
0
1
2
3
4
"NEW WINDOW!"
5
6
7
8
9
*/
)
.subscribe(val => console.log(val));
}
开发者ID:zwvista,项目名称:SampleMisc,代码行数:31,代码来源:transforming.service.ts
示例6: of
observable1 = constructorZone1.run(() => {
return of(1, 2).pipe(
map((v: any) => {
return of(v + 1);
}),
mergeAll());
});
开发者ID:angular,项目名称:zone.js,代码行数:7,代码来源:rxjs.Observable.merge.spec.ts
注:本文中的rxjs/operators.mergeAll函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论