Last active
August 29, 2015 13:57
-
-
Save briancavalier/9882393 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('when/monitor/console'); | |
var when = require('when'); | |
// Creates a cycle p1 -> p2 -> p3 -> p4 -> p1 | |
var p1 = when.promise(function(r1) { | |
var p2 = when.promise(function(r2) { | |
var p3 = when.promise(function(r3) { | |
var p4 = when.promise(function(r4) { | |
setTimeout(function() { | |
r4(p1); // Cycle! resolve p4 with p1 | |
}, 100); | |
}); | |
r3(p4); | |
}); | |
r2(p3); | |
}); | |
r1(p2); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TypeError: Promise cycle | |
at null._onTimeout (/Users/brian/Projects/cujojs/when/experiments/cycle.js:10:6) | |
[object Object] | |
at /Users/brian/Projects/cujojs/when/experiments/cycle.js:8:18 | |
at /Users/brian/Projects/cujojs/when/experiments/cycle.js:7:17 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment