Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 31d1037

Browse files
Refactoring schedule recursive
1 parent 338f1c8 commit 31d1037

28 files changed

Lines changed: 146 additions & 86 deletions

dist/rx.all.compat.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,22 +1223,28 @@
12231223
var state = pair[0], action = pair[1], group = new CompositeDisposable();
12241224

12251225
function recursiveAction(state1) {
1226-
action(state1, function (state2) {
1227-
var isAdded = false, isDone = false,
1228-
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
1226+
1227+
function innerAction(state2) {
1228+
var isAdded = false, isDone = false;
1229+
1230+
function scheduleWork(_, state3) {
12291231
if (isAdded) {
12301232
group.remove(d);
12311233
} else {
12321234
isDone = true;
12331235
}
12341236
recursiveAction(state3);
12351237
return disposableEmpty;
1236-
});
1238+
}
1239+
1240+
d = scheduler.scheduleWithState(state2, scheduleWork);
12371241
if (!isDone) {
12381242
group.add(d);
12391243
isAdded = true;
12401244
}
1241-
});
1245+
}
1246+
1247+
action(state1, innerAction);
12421248
}
12431249
recursiveAction(state);
12441250
return group;

dist/rx.all.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,22 +1032,28 @@
10321032
var state = pair[0], action = pair[1], group = new CompositeDisposable();
10331033

10341034
function recursiveAction(state1) {
1035-
action(state1, function (state2) {
1036-
var isAdded = false, isDone = false,
1037-
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
1035+
1036+
function innerAction(state2) {
1037+
var isAdded = false, isDone = false;
1038+
1039+
function scheduleWork(_, state3) {
10381040
if (isAdded) {
10391041
group.remove(d);
10401042
} else {
10411043
isDone = true;
10421044
}
10431045
recursiveAction(state3);
10441046
return disposableEmpty;
1045-
});
1047+
}
1048+
1049+
d = scheduler.scheduleWithState(state2, scheduleWork);
10461050
if (!isDone) {
10471051
group.add(d);
10481052
isAdded = true;
10491053
}
1050-
});
1054+
}
1055+
1056+
action(state1, innerAction);
10511057
}
10521058
recursiveAction(state);
10531059
return group;

dist/rx.all.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.compat.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,22 +1137,28 @@
11371137
var state = pair[0], action = pair[1], group = new CompositeDisposable();
11381138

11391139
function recursiveAction(state1) {
1140-
action(state1, function (state2) {
1141-
var isAdded = false, isDone = false,
1142-
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
1140+
1141+
function innerAction(state2) {
1142+
var isAdded = false, isDone = false;
1143+
1144+
function scheduleWork(_, state3) {
11431145
if (isAdded) {
11441146
group.remove(d);
11451147
} else {
11461148
isDone = true;
11471149
}
11481150
recursiveAction(state3);
11491151
return disposableEmpty;
1150-
});
1152+
}
1153+
1154+
d = scheduler.scheduleWithState(state2, scheduleWork);
11511155
if (!isDone) {
11521156
group.add(d);
11531157
isAdded = true;
11541158
}
1155-
});
1159+
}
1160+
1161+
action(state1, innerAction);
11561162
}
11571163
recursiveAction(state);
11581164
return group;

dist/rx.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.compat.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.core.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,22 +511,28 @@ var
511511
var state = pair[0], action = pair[1], group = new CompositeDisposable();
512512

513513
function recursiveAction(state1) {
514-
action(state1, function (state2) {
515-
var isAdded = false, isDone = false,
516-
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
514+
515+
function innerAction(state2) {
516+
var isAdded = false, isDone = false;
517+
518+
function scheduleWork(_, state3) {
517519
if (isAdded) {
518520
group.remove(d);
519521
} else {
520522
isDone = true;
521523
}
522524
recursiveAction(state3);
523525
return disposableEmpty;
524-
});
526+
}
527+
528+
d = scheduler.scheduleWithState(state2, scheduleWork);
525529
if (!isDone) {
526530
group.add(d);
527531
isAdded = true;
528532
}
529-
});
533+
}
534+
535+
action(state1, innerAction);
530536
}
531537
recursiveAction(state);
532538
return group;

0 commit comments

Comments
 (0)