RxJS. Delay from array
import { of, from } from 'rxjs';
import { map, concatMap, delay } from 'rxjs/operators';
from([2,4,6,8]).pipe(
concatMap(item => of(item).pipe(delay(1000)))
).subscribe(console.log); Stackblitz (in console):
import { of, from } from 'rxjs';
import { map, concatMap, delay } from 'rxjs/operators';
from([2,4,6,8]).pipe(
concatMap(item => of(item).pipe(delay(1000)))
).subscribe(console.log); Stackblitz (in console):
forkJoin - параллельные запросы, mergeMap - последовательные запросы
function getQueryParam(item) {
var svalue = window.location.search.match(new RegExp('[\?\&]' + item + '=([^\&]*)(\&?)', 'i'));
return svalue ? svalue[1] : svalue;
}
// /foo/bar/baz.html?lang=ru
var lang = getQueryParam('lang') || 'en'; const { password: _, ...result } = {
id: 7,
name: 'tyapk',
password: '12345',
}