New Promise Syntax Proposal

Isiah Meadows isiahmeadows at gmail.com
Mon Nov 6 16:07:45 UTC 2017


You may find it interesting that Node.js created a private symbol to allow
that and others (like `fs.exists`) to be promisified similarly, even though
they don't follow the standard convention.

On Mon, Nov 6, 2017, 10:57 Jonathan Barronville <jonathan at belairlabs.com>
wrote:

> @T.J. Crowder: Interestingly, in this case, it looks like the
> `readline` module’s [`@question(…)`
> API](
> https://nodejs.org/docs/v9.0.0/api/readline.html#readline_rl_question_query_callback
> )
> doesn’t even use the usual Node.js-style callback, which is what
> [`util.promisify`](
> https://nodejs.org/docs/v9.0.0/api/util.html#util_util_promisify_original)
> expects …
>
> On Mon, Nov 6, 2017 at 10:43 AM, T.J. Crowder
> <tj.crowder at farsightsoftware.com> wrote:
> > On Mon, Nov 6, 2017 at 3:39 PM, Jorge Téllez
> > <novohispano at gmail.com> wrote:
> >> Yes, I’ll be happy to provide a concrete example.
> >
> > Very useful example!
> >
> > In that scenario I'd convert to promises *early*, by promisifying the
> > `interface.question` function once (using [`util.promisify`][1] or
> > roll-your-own if needed), and then using the promisified version
> throughout
> > (which lets you use `async` functions).
> >
> > -- T.J. Crowder
> >
> > [1]: https://nodejs.org/api/util.html#util_util_promisify_original
>
>
>
> --
> - Jonathan
>
>>
> Life is a game and we’re all just high density pixels.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171106/a64d3d98/attachment-0001.html>


More information about the es-discuss mailing list