unwrap thennable

This commit is contained in:
Leo Horie 2014-04-05 21:16:49 -04:00
parent efae454bd4
commit 5ecc942abd
6 changed files with 34 additions and 4 deletions

View file

@ -319,7 +319,8 @@ new function(window) {
list.push(function(value) {
try {
var result = callback(value)
next[method](result !== undefined ? result : value)
if (result && typeof result.then == "function") result.then(next[method], error)
else next[method](result !== undefined ? result : value)
}
catch (e) {
if (e instanceof Error && e.constructor !== Error) throw e