Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
n-api: add cleanup hook APIs for JSRT
Browse files Browse the repository at this point in the history
Added `napi_add_env_cleanup_hook` and `napi_remove_env_cleanup_hook`
implementations.
  • Loading branch information
kfarnung committed Jun 28, 2018
1 parent 4cbe08a commit 04db466
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/node_api_jsrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,28 @@ void napi_module_register(napi_module* mod) {
node::node_module_register(nm);
}

napi_status napi_add_env_cleanup_hook(napi_env env,
void (*fun)(void* arg),
void* arg) {
CHECK_ENV(env);
CHECK_ARG(fun);

node::AddEnvironmentCleanupHook(env->isolate, fun, arg);

return napi_ok;
}

napi_status napi_remove_env_cleanup_hook(napi_env env,
void (*fun)(void* arg),
void* arg) {
CHECK_ENV(env);
CHECK_ARG(fun);

node::RemoveEnvironmentCleanupHook(env->isolate, fun, arg);

return napi_ok;
}

// Static last error returned from napi_get_last_error_info
napi_extended_error_info static_last_error;

Expand Down

0 comments on commit 04db466

Please sign in to comment.