Skip to content

Conversation

@nzhl
Copy link

@nzhl nzhl commented Jan 20, 2019

以下代码在你之前的commit 中会正确打印出A, B 和浏览器行为符合
但是最新的一次commit之后不能正确打印A, B。
我已经对这个问题进行了修复。

另一方面, 我看了你那篇解析文章之后, 给你的代码加入了大量注释, 文件名为 promise.js。

这次 pr 主要是希望能帮助到更多人, 谢谢。

var p3 = new Promise( function(resolve,reject){
	resolve( "B" );
} );

var p1 = new Promise( function(resolve,reject){
	resolve( p3 );
} );

var p2 = new Promise( function(resolve,reject){
	resolve( "A" );
} );

p1.then( function(v){
	console.log( v );
} );

p2.then( function(v){
	console.log( v );
} );

// A B  <-- 不是你可能期望的 B A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant