rxjs/operators#mergeWith TypeScript Examples
The following examples show how to use
rxjs/operators#mergeWith.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GridEngine.ts From grid-engine with Apache License 2.0 | 6 votes |
/**
* @returns Observable that emits when a new character is added or an existing is removed.
*/
characterShifted(): Observable<CharacterShift> {
return this.charAdded$.pipe(
map((c) => ({
charId: c,
action: CharacterShiftAction.ADDED,
})),
mergeWith(
this.charRemoved$.pipe(
map((c) => ({
charId: c,
action: CharacterShiftAction.REMOVED,
}))
)
)
);
}
Example #2
Source File: index.ts From dbm with Apache License 2.0 | 6 votes |
/* ----------------------------------------------------------------------------
* Functions
* ------------------------------------------------------------------------- */
/**
* Resolve a pattern
*
* @param pattern - Pattern
* @param options - Options
*
* @returns File observable
*/
export function resolve(
pattern: string, options?: ResolveOptions
): Observable<string> {
return from(glob(pattern, options))
.pipe(
catchError(() => EMPTY),
switchMap(files => from(files)),
options?.watch
? mergeWith(watch(pattern, options))
: identity
)
}