回答編集履歴

4

fix

2015/12/23 16:32

投稿

AyaMorisawa
AyaMorisawa

スコア26

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  var targetB; //処理対象B
10
10
 
11
-
11
+
12
12
 
13
13
  loadSomething(targetA).then(function(something) {
14
14
 
@@ -26,6 +26,12 @@
26
26
 
27
27
  ```js
28
28
 
29
+ var targetA;
30
+
31
+ var targetB;
32
+
33
+
34
+
29
35
  loadSomething(targetA)
30
36
 
31
37
  .then(loadAnotherthing.bind(null, targetB))

3

質問が更新されたので回答を更新

2015/12/23 16:32

投稿

AyaMorisawa
AyaMorisawa

スコア26

test CHANGED
@@ -1,10 +1,18 @@
1
1
  ```js
2
2
 
3
- //##【質問】外側のPromiseの結果を内側のPromise loadAnotherthingの引数として利用したい場合
3
+ //##【質問】外側のPromiseの結果を内側のPromise loadAnotherthingの引数として利用し
4
4
 
5
- loadSomething().then(function(something) {
5
+ // 処理対象(targetB)を処理したい
6
6
 
7
+ var targetA; //処理対象A
8
+
9
+ var targetB; //処理対象B
10
+
11
+
12
+
13
+ loadSomething(targetA).then(function(something) {
14
+
7
- loadAnotherthing(something).then(function(another) {
15
+ loadAnotherthing(targetB, something).then(function(another) {
8
16
 
9
17
  DoSomethingOnThem(another);
10
18
 
@@ -18,6 +26,10 @@
18
26
 
19
27
  ```js
20
28
 
29
+ loadSomething(targetA)
30
+
21
- loadSomething().then(loadAnotherthing).then(DoSomethingOnThem);
31
+ .then(loadAnotherthing.bind(null, targetB))
32
+
33
+ .then(DoSomethingOnThem);
22
34
 
23
35
  ```

2

説明削除

2015/12/23 16:31

投稿

AyaMorisawa
AyaMorisawa

スコア26

test CHANGED
@@ -21,7 +21,3 @@
21
21
  loadSomething().then(loadAnotherthing).then(DoSomethingOnThem);
22
22
 
23
23
  ```
24
-
25
-
26
-
27
- `function (x) { f(x); }`と`f`は等しいです。

1

説明追加で

2015/12/22 14:35

投稿

AyaMorisawa
AyaMorisawa

スコア26

test CHANGED
@@ -21,3 +21,7 @@
21
21
  loadSomething().then(loadAnotherthing).then(DoSomethingOnThem);
22
22
 
23
23
  ```
24
+
25
+
26
+
27
+ `function (x) { f(x); }`と`f`は等しいです。