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 { Effect, type Schema } from "effect"; | |
| export type EventHandler<A, I, X> = { | |
| readonly channel: `/${string}/`; | |
| readonly schema: Schema.Schema<A, I>; | |
| readonly handle: (data: A) => Effect.Effect<void, X, never>; | |
| }; | |
| export type InfallibleEventHandler<A, I> = { | |
| [K in keyof EventHandler<A, I, never>]: EventHandler<A, I, never>[K]; |
I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).
Use ssh keys and define host aliases in ssh config file (each alias for an account).
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent