![https://alexn.org/blog/2017/10/11/javascript-promise-leaks-memory/](https://cdn-ak-scissors.b.st-hatena.com/image/square/516b841cfb9eab6e42750ab7ca0a62f4f849fa4f/height=288;version=1;width=512/https%3A%2F%2Falexn.org%2Fassets%2Fmedia%2Farticles%2Fjs-then.png%3F202406010758)
Promise Cancellation Is Dead — Long Live Promise Cancellation! Not very long ago Domenic Denicola (worth a follow, a very smart guy) withdrew his proposal for promise cancellation from the TC39. A lot of people might think that means that promise cancellation isn’t coming to JavaScript. Those people would be right, if you couldn’t already cancel a promise via very similar means to what was propose
A topic that frequently confuses users in the #Node.js channel, is the Promise.try method provided by Bluebird. People often struggle to understand what it is, or why they should use it - and this isn't helped by the fact that almost all guides to Promises fail to demonstrate its use. In this brief article, I hope to provide a better explanation of what Promise.try is, and why you should always us
react-router@1.0.0-rc3を使っていると、onEnterでStoreを更新して、終わってからRouteへ移動したい。Angularで言うui-routerのresolveが欲しいと思っていました。 EventEmitterを継承して.emitをオーバーライドすれば対応可能です。軽くテストを通したライブラリも公開しています。1 具体的には下記のように実装します。 // Dependencies import {EventEmitter} from 'events' // Public class AsyncEmitter extends EventEmitter{ emit(event,...args){ let promises= [] this.listeners(event).forEach(listener=>{ promises.push(listener(...
About the content This content has been published here with the express permission of the author. Promises are a well-known design pattern used to delay evaluation of future values, and to pipeline operations in an asynchronous manner. Typically, there are three internal states used to control the behavior of promises, but there is a lack of core interfaces essential to iOS & OS X development. To
In my introduction to monads in JavaScript we saw a couple of monads and examined the commonality between them to expose an underlying design pattern. Before I get on to how that applies to asynchronous programming we need to take one final diversion and discuss polymorphism. Consider the list monad that we implemented before: var compose = function(f, g) { return function(x) { return f(g(x)) }; }
Promises are being debated in the JavaScript community. The most popular specification is Promises/A+. It’s a fairly small specification, containing only a single function: then. The function is heavily overloaded which makes it quite complicated - way more than it has to be. I’ll try to show how category theory can give us a much simpler, more generalised and lawful API! A proper Promise/A+ imple
⚠️ Beware of Scams: since Feb 2024, scammers are using fake Scala websites to sell courses, please check you are using an official source. Philipp Haller, Aleksandar Prokopec, Heather Miller, Viktor Klang, Roland Kuhn, Vojin Jovanovic 著 Eugene Yokota 訳 概要 Future は並列に実行される複数の演算を取り扱うのに便利な方法を提供する。それは効率的でノンブロッキングな方法だ。 大まかな考え方はシンプルなもので、Future はまだ存在しない計算結果に対するプレースホルダのようなものだ。 一般的に、Future の結果は並行に計算され後で集計す
(2015/10/21追記) 記事を書いてから半年経ちましたが、最近はRxの良さを理解したり、ES7のasync/awaitがbabelによって実用的になりつつあったり等、またもやベストプラクティスとはなんだったのか状態です。とはいえ、いまのところPromiseは非同期処理の土台であり続けそうですし、Generatorもasync/awaitへの足がかりとして知っておくことのメリットは大きいかと思いますので、引き続き公開させたままとさせて頂きます。 (追記ここまで) 数ある非同期処理のプラクティスを試してみて、だいたいこれが良いんじゃないかというパターンが固まったので書きます。効用はコールバック地獄からの脱出と結局非同期どれが良いの感の払拭。ES6寄りです。 前提知識 JavaScript Promiseの本 http://azu.github.io/promises-book/ ジェネレ
JavaScript Advent Calendar 2014 11日目。 いきなり要約: Promiseや非同期テストのアサーションを簡単確実に書けるようになるesplanというライブラリのPoCを作った話。 Promiseや非同期のテストは難しい 詳しくはJavaScript Promiseの本: Chapter.3 Promiseのテストをご覧いただきたいのだが、Promiseのテストを正確に書くのはそんなに簡単ではない。 例えばmochaだと、 // 間違ったテスト1: // mayBeResolveWithOne() が1以外でresolveしたときタイムアウトエラーになる it("mayBeResolveWithOne()は1でresolveする", function(done) { mayBeResolveWithOne().then(function(value) { as
In my previous post, I explored how programming with promises can be made close to programming with values. After some more work on it, and some learning from bluebird, I came to conclude that my brain doesn’t think well with promises. So I wrote a macro for Javascript that expands “tasks” into async state machines that communicate using channels (i.e. CSP). I want to talk about the specific optio
Syncing Async with Kyle Simpson Save 10% off ANY FITC event with discount code 'slideshare' See our upcoming events at www.fitc.ca I bet you think “callback hell” is about function nesting and levels of indentation. Not so much. I bet you’ve heard that Promises replace callbacks. Nope. We need some clarity on what async flow control is all about in JavaScript. We’ll explore the perils of “Inversio
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く