We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whenに渡したdeferredをnotifyWithした時に、when()の戻り値から追加したprogressフィルタが実行されるが、その中のthisがrejectWithで指定したものになっていない。notify時と同様にnotifyしたdfdオブジェクトになっている。
jQuery.whenのprogressは、whenに渡したものからnotifyWithを呼ぶと、thisが配列にになる。
var context; $.when(df1, df2).progress(function(){ context = this; }); df1.notifyWith({a:1}); // context [{a:1}, undefined] df2.notifyWith({b:1}); // context [{a:1}, {b:1}]
jQuery.whenと同じような挙動にする。
The text was updated successfully, but these errors were encountered:
hifive#219 対応しました。
9e0274a
jQueryのバージョンによってcontextが異なります。jQuery1.8.0以降なら各dfdのreject/rejectWith時のthisが配列になって格納されます。(上記説明と同じ)。 しかしjQuery1.7以下では以下のような挙動になります。
// retは$.whenの戻り値のプロミス notify/notifyWith: this === ret resolve/resolveWith: thisはretの元のdeferred。(this !== ret; this.promise() === ret;) reject: this === rejectを呼んだdeferred rejectWith: this === rejectWithの第一引数
jQuery1.6.4にnotify/notifyWithはありませんが、それいがいはjQuery1.7と同じ挙動でした。
h5.async.whenでは基本的には$.whenのコールバックに渡されたthisを使用するようにしますが、thisが$.when()の戻り値のプロミスまたはそのプロミスの元となっているdeferredの場合(notify/notifyWith/resolve/resolveWithの場合)は、h5.async.whenの戻り値のプロミスまたはそのdeferredに差し替えるようにしました。(上記コミットで対応しています。)
Sorry, something went wrong.
hifive#210 hifive#219 hifive#212 テストケース追加しました。
dcb1e57
fukudayasuo
No branches or pull requests
whenに渡したdeferredをnotifyWithした時に、when()の戻り値から追加したprogressフィルタが実行されるが、その中のthisがrejectWithで指定したものになっていない。notify時と同様にnotifyしたdfdオブジェクトになっている。
jQuery.whenのprogressは、whenに渡したものからnotifyWithを呼ぶと、thisが配列にになる。
jQuery.whenと同じような挙動にする。
The text was updated successfully, but these errors were encountered: