3 ms·
Why would you consider it an anti-pattern? To me, that term implies that an idiom has some sort of pitfall. Like using `==`, for instance. But `that = this` is
by acjohnson55 10y ago
Why would you consider it an anti-pattern? To me, that term implies that an idiom has some sort of pitfall. Like using `==`, for instance. But `that = this` is actually pretty robust. Although, I'd say arrow functions are the better solution if all you need is a callback.
Pervasive usage of `bind` drives me mad. It can patch over problems if you're using it locally, but if a function is being passed around, it invisibly has different behavior from a normal function with dynamic `this`. It also is quite noisey, in my opinion.
Using methods of an object to contain the sequences of an async process is handy. But it's not as flexible as promises, because it only works if the async process is self-contained. Promises are far more composable, which is important for modular processes. And with `async` functions, they allow native flow control structures to cross async boundaries. By comparison, a the methods+callbacks approach feels like programing with GOTO in BASIC.