String operations allow you to do string manipulation with observables.
concat()
Concats two or more observables or values. The first value MUST be a string or an observable emitting strings:
1import { concat } from 'rxmetics';
2import { mod } from 'rxmetics/pipes';
3import { interval } from 'rxjs';
4
5concat('', interval(1000), ' : ', interval(10).pipe(mod(100)))
6.subscribe(v => document.body.textContent = v);
You can also use the concat()
pipe instead. As before, you MUST pipe it to an observable
emitting strings:
1import { mod, concat } from 'rxmetics/pipes';
2import { interval, of } from 'rxjs';
3
4of('').pipe(
5 concat(interval(1000), ' : '),
6 concat(interval(10).pipe(mod(100)))
7).subscribe(v => document.body.textContent = v);
You can use rxl
template prefix to use observables in your template strings:
1import { rxl } from 'rxmetics';
2import { mod } from 'rxmetics/pipes';
3import { interval } from 'rxjs';
4
5rxl`[PRECISE TIMER]:: ${interval(1000)} : ${interval(10).pipe(mod(100))}`
6 .subscribe(v => document.body.textContent = v);