Comparing Node.js Promises, Try/Catch, Angular Zone.js and yes, Zone by Alex Gorbatchev Apr 15, 2014 / Community, How-To Handling errors in asynchronous flow In a previous article we talked about managing async flow and escaping the callback hell. The problem Handling errors in synchronous flow is pretty straightforward and easy. Handling errors in asynchronous flow in a clean and easy to follow m
Promises are not slow. At least, not anymore. Infact, bluebird generators are almost as fast as regular callback code (they're also the fastest generators as of now). And bluebird promises are definitely at least two times faster than async.waterfall. Considering that bluebird wraps the underlying callback-based libraries and makes your own callbacks exception-safe, this is really amazing. async.w
tl;dr サンプルコードを付けたら記事がかなり長くなってしまったのでご注意下さい。 Node.jsの current master で V8がアップデートされ ES6の Promise が使えるようになりました(要オプションですが)。Promise を使うと Node.jsの非同期処理がどのようになるのか、Stream と Promise を組み合わせた使い方なども含めて紹介します。 1. はじめに Nodeの次期安定版 v0.12は、すぐ出ると言われながら既に v0.10のリリースから1年が過ぎてしまいました。 現在、v0.12の主要な新機能の実装は完了していますが、まだ安定版のリリースに向けて手当できていない部分が残っている感じです。そんな残っている部分の一つだった V8 のアップデートが先週末に行われました。 deps: update v8 to 3.24.40 (3/19現在は
概要 Promiseとは非同期処理を上手く扱う為のAPIであり、パターンである。 非同期の処理の完了後に続けて処理を行いたいとき、よくコールバックパターンが使われるが、処理が連続するとコールバック地獄と言われる分かりづらいソースコードになってしまう。 また、複数の非同期処理が完了した時に処理を行うなど、コールバックパターンでは難しい事をスマートにできるのがこのPromiseである。 今まではDOMの方でDOM Promiseとして仕様策定が進められていたり、ライブラリのDeferredが有名だったが、ES2015標準に入ることになり、V8に実装された。 実装されたメソッド Promise.resolve(x) Promise.reject(x) Promise.all( [p1, p2, p3, ......] ) Promise.race( [p1, p2, p3, ......] )
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く