Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx [nginx-announce] njs-0.3.8

Discussion in 'Nginx and PHP-FPM news & discussions' started by eva2000, Jan 22, 2020.

  1. eva2000

    eva2000 Administrator Staff Member

    49,561
    11,374
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +17,677
    Local Time:
    3:31 PM
    Nginx 1.21.x
    MariaDB 10.x
    Hello,

    I'm glad to announce a new release of NGINX JavaScript module (njs).

    This release proceeds to extend the coverage of ECMAScript
    specifications. This release adds Promise object support and
    typed-arrays from ES6.

    Notable new features:
    - Promise support in r.subrequest():
    : r.subrequest(r, '/auth')
    : .then(reply => JSON.parse(reply.responseBody))
    : .then(response => {
    : if (!response['token']) {
    : throw new Error("token is not available");
    : }
    : return token;
    : })
    : .then(token => {
    : r.subrequest('/backend', `token=${token}`)
    : .then(reply => r.return(reply.status, reply.responseBody));
    : })
    : .catch(_ => r.return(500));

    You can learn more about njs:

    - Overview and introduction: http://nginx.org/en/docs/njs/
    - Presentation: https://youtu.be/Jc_L6UffFOs
    - Using node modules with njs:
    http://nginx.org/en/docs/njs/node_modules.html

    Feel free to try it and give us feedback on:

    - Github: https://github.com/nginx/njs/issues
    - Mailing list: http://mailman.nginx.org/mailman/listinfo/nginx-devel



    Changes with njs 0.3.8 21 Jan 2020

    nginx modules:

    *) Feature: added Promise support for r.subrequest(). If callback
    is not provided r.subrequest() returns an ordinary Promise object
    that resolves to subrequest response object.

    *) Change: r.parent property handler now returns "undefined"
    instead of throwing exception if parent object is not available.

    Core:

    *) Feature: added Promise support. Implemented according to
    the specification without: Promise.all(), Promise.allSettled(),
    Promise.race().

    *) Feature: added initial Typed-arrays support.
    Thanks to Tiago Natel de Moura.

    *) Feature: added ArrayBuffer support.
    Thanks to Tiago Natel de Moura.

    *) Feature: added initial Symbol support.
    Thanks to Artem S. Povalyukhin.

    *) Feature: added externals supopor for JSON.stringify().

    *) Feature: added Object.is().
    Thanks to Artem S. Povalyukhin.

    *) Feature: added Object.setPrototypeOf().
    Thanks to Artem S. Povalyukhin.

    *) Feature: introduced nullish coalescing operator.
    Thanks to Valentin Bartenev.

    *) Bugfix: fixed Object.getPrototypeOf() according to the
    specification.

    *) Bugfix: fixed Object.prototype.valueOf() according to the
    specification.

    *) Bugfix: fixed JSON.stringify() with unprintable values and
    replacer function.

    *) Bugfix: fixed operator "in" according to the specification.

    *) Bugfix: fixed Object.defineProperties() according to the
    specification.

    *) Bugfix: fixed Object.create() according to the specification.
    Thanks to Artem S. Povalyukhin.

    *) Bugfix: fixed Number.prototype.toString(radix) when
    fast-math is enabled.

    *) Bugfix: fixed RegExp() instance properties.

    *) Bugfix: fixed import segfault.
    Thanks to 洪志道 (Hong Zhi Dao).
    _______________________________________________
    nginx-announce mailing list
    nginx-announce@nginx.org
    http://mailman.nginx.org/mailman/listinfo/nginx-announce

    Continue reading...