You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Intro XHR から fetch() に積極的に移行しづらかった最大のミッシングピースとして、中断できないという問題があった。 これは、fetch() が選んだ Promise ベースのインタフェースにおいて、キャンセルをどうするかという議論と絡み、長く決着が付かずにいた問題である。 最近、やっと話が前進したので、ここまでの経過を解説する。 Fetch のミッシングピース fetch() は、ブラウザが発行するリクエストと、取得するレスポンスを扱う低レベルなインタフェースとして策定が始まった。 DOM の API が Promise ベースに移行しつつある流れを汲み、fetch() もまた Promise を返す関数一発スタイルになった。 クラスからインスタンスを生成しメソッドを呼ぶ XHR スタイルでは、インスタンスを再利用した場合の挙動などを含め、オブジェクトのライフサイクルを考慮
Node.js のコアに util.promisify が追加された。 github.com 今回は util.promisify が持つ役割を中心に Node.js における Promise の立場についても話していけるといいと思う。 util.promisify とは 読んで字のごとく関数を Promise に変換してくれるユーティリティメソッド。 下記のような要領で変換できる。 const util = require('util'); const fs = require('fs'); const stat = util.promisify(fs.stat); stat('.').then((stats) => { console.log(stats); }).catch((error) => { console.error(error); }); async-awaitを使いたい
Here I’m presenting two cool little functions that are making my days spent in the JS Promise land just a bit happier. All code snippets are written using ECMAScript 2015. So, I’ve often found myself writing code like this: const getUser = (id) => { return httpClient.get('https://facebook.com/user/' + id) .then((response) => { // Side Effects Logic return cacheData(response); }) .then((response) =
この記事は bouzuya's RxJS Advent Calendar 2015 23 日目かつ RxJS Advent Calendar 2015 の 23 日目です。 はじめに 今日は Promise と Obervable とを相互変換する方法について書きます。 Observable と Promise Promise は ES2015 で標準化され、各種 Web browser で実装されて、 JavaScript の非同期処理の代表的なものになっています。 RxJS の Observable は Promise からの変換や Promise への変換に対応しています。 Promise の扱いについて見ていきます。 Promise to Observable Observable.fromPromise Observable.fromPromise API Document Ob
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
はじめに JavaScriptは非同期処理との闘いです。 人類が非同期処理を倒すために、Promiseやasync-awaitという最終兵器を生み出して、劇的にクリーンで平和な世界が生まれたという話は以前しました => (もしかして: JavaScriptは如何にしてAsync/Awaitを獲得したのか Qiita版) しかあぁし!!! 甘い、甘いのですよ!!!!! 人類を苦しめ続ける非同期処理が、そんな簡単に完全に倒せるわけがないのですよ。 非同期処理の本当にヤバイ深淵、それが「例外処理」です。 みなさんはPromiseで開発していて、 「なんか途中までうまく行ってたんだけど気づいたら例外が外側に飛ばなくなった…なんでだ…」 「助けて!Promiseにcatch書いてるのに何故か例外がcatch出来ないの!!!」 という経験はないでしょうか。私は何度もあります。 この記事では、具体的に何
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く