TLDR: Use for...of instead of forEach() in asynchronous code.
For legacy browsers, use for(...;...;...) or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
| import * as fromEvents from '../actions/events.action'; | |
| import { createEntityAdapter, EntityAdapter, EntityState } from '@ngrx/entity'; | |
| import { Event } from '../../models/event.model'; | |
| export interface EventsState extends EntityState<EventEntity> { | |
| loaded: boolean; | |
| loading: boolean; | |
| error: Error; | |
| } |
| syntax on | |
| set ruler " Show the line and column numbers of the cursor. | |
| set formatoptions+=o " Continue comment marker in new lines. | |
| set textwidth=0 " Hard-wrap long lines as you type them. | |
| set modeline " Enable modeline. | |
| set esckeys " Cursor keys in insert mode. | |
| set linespace=0 " Set line-spacing to minimum. | |
| set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) | |
| " More natural splits | |
| set splitbelow " Horizontal split below current. |
| const randomColor = (() => { | |
| "use strict"; | |
| const randomInt = (min, max) => { | |
| return Math.floor(Math.random() * (max - min + 1)) + min; | |
| }; | |
| return () => { | |
| var h = randomInt(0, 360); | |
| var s = randomInt(42, 98); |