Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There seems a bug in the codes. #2

Closed
jianxinss opened this issue Jun 10, 2015 · 1 comment
Closed

There seems a bug in the codes. #2

jianxinss opened this issue Jun 10, 2015 · 1 comment

Comments

@jianxinss
Copy link

function resolvePromise(promise1, promise2) {
        var status = promise2.status;

        if('pending' === status) {
            promise2.then(promise1.resolve.bind(promise1), promise1.reject.bind(promise1));
        }
        if('resolved' === status) promise1.resolve(promise2.value);
        if('rejected' === status) promise1.reject(promise2.reason);

        return promise;
    };

the return value is undefined;

And what's more ,could you please explain the code to me. Because It seems hard to me . Thank u .

@chemdemo
Copy link
Owner

Thanks for point it out, and i had fixed it. It should return a promise too, see here.

Will, for more detail about Promise/A+, you can read the spec.

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

No branches or pull requests

2 participants