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

[v10.x]: Backport instance data #30537

Commits on Dec 18, 2019

  1. n-api: turn NAPI_CALL_INTO_MODULE into a function

    These do not need to be macros.
    
    PR-URL: nodejs#26128
    Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>
    addaleax authored and Gabriel Schulhof committed Dec 18, 2019
    Configuration menu
    Copy the full SHA
    09776ba View commit details
    Browse the repository at this point in the history
  2. n-api: add APIs for per-instance state management

    Adds `napi_set_instance_data()` and `napi_get_instance_data()`, which
    allow native addons to store their data on and retrieve their data from
    `napi_env`. `napi_set_instance_data()` accepts a finalizer which is
    called when the `node::Environment()` is destroyed.
    
    This entails rendering the `napi_env` local to each add-on.
    
    Fixes: nodejs/abi-stable-node#378
    PR-URL: nodejs#28682
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
    Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
    Gabriel Schulhof committed Dec 18, 2019
    Configuration menu
    Copy the full SHA
    dc7d5fd View commit details
    Browse the repository at this point in the history