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

new Promise without first argument #515

Closed
xlaywan opened this Issue Apr 2, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@xlaywan

xlaywan commented Apr 2, 2016

Instead of:

let promise = new Promise((resolve, reject) => {
    if (true)
        resolve()
    else
        reject()
})

This

let promise = new Promise
if (true)
    promise.resolve()
else
    promise.reject()

Less nesting. What do you think?

@UltCombo

This comment has been minimized.

Show comment
Hide comment
@UltCombo

UltCombo Apr 2, 2016

Contributor

That's called a deferred, and is a rather different concept. Any code that has access to the deferred object has full control over it and can resolve or reject it with any value, which is often considered insecure or undesirable.

In any case, this repository is not a place for such discussions. Please see the CONTRIBUTING doc and post proposals to the ES Discuss mailing list.

Contributor

UltCombo commented Apr 2, 2016

That's called a deferred, and is a rather different concept. Any code that has access to the deferred object has full control over it and can resolve or reject it with any value, which is often considered insecure or undesirable.

In any case, this repository is not a place for such discussions. Please see the CONTRIBUTING doc and post proposals to the ES Discuss mailing list.

@bterlson

This comment has been minimized.

Show comment
Hide comment
@bterlson

bterlson Apr 6, 2016

Member

Yeah, it's a deferred. Oft-discussed possible addition, but not an alternative to what is presently spec'd.

Member

bterlson commented Apr 6, 2016

Yeah, it's a deferred. Oft-discussed possible addition, but not an alternative to what is presently spec'd.

@bterlson bterlson closed this Apr 6, 2016

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