本文整理汇总了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);
});
示例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));
}
示例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()
);
}
示例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));
}
示例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));
}
示例6: of
observable1 = constructorZone1.run(() => {
return of(1, 2).pipe(
map((v: any) => {
return of(v + 1);
}),
mergeAll());
});