Real-Serious-Games / C-Sharp-Promise

Promises library for C# for management of asynchronous operations.
MIT License
1.2k stars 149 forks source link

Different results for javascript.Promise and C-Sharp-Promise #113

Closed takenaoki closed 3 years ago

takenaoki commented 3 years ago

Different results for javascript.Promise and C-Sharp-Promise.

Is there any problem?

javascript

スクリーンショット 2021-06-10 11 57 10

C-Sharp-Promise

スクリーンショット 2021-06-10 12 16 43 スクリーンショット 2021-06-10 12 40 15
zsoi commented 3 years ago

This is due to the way promise resolves/rejects are always called in the next "tick" (setTimeout) after resolve/rejection in JS, but RSG.Promise evaluates immediately without waiting a "tick" (as there usually is no such thing in C# as the event loop. But AFAIR you can implement the event loop yourself and tell RSG.Promise to utilize it). (See A+ spec, note 3.1: https://promisesaplus.com/#point-67)

takenaoki commented 3 years ago

@zsoi Thank you for answering!