diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-11-05 22:50:24 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-11-07 19:51:11 -0800 |
commit | e460e14d57869c37b181f1e4839c70d8fa89ffb3 (patch) | |
tree | 9c481c15fbce5e5a5e8413518faf099badb5ae0b /src/node.h | |
parent | 96db5a271c859eabbf81565e4ce82a93fd037fb9 (diff) | |
download | android-node-v8-e460e14d57869c37b181f1e4839c70d8fa89ffb3.tar.gz android-node-v8-e460e14d57869c37b181f1e4839c70d8fa89ffb3.tar.bz2 android-node-v8-e460e14d57869c37b181f1e4839c70d8fa89ffb3.zip |
src: allow adding linked bindings to Environment
This allows manually adding linked bindings to an `Environment`
instance, without having to register modules at program load in
a global namespace.
PR-URL: https://github.com/nodejs/node/pull/30274
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h index 8215552227..7602d14ed7 100644 --- a/src/node.h +++ b/src/node.h @@ -668,6 +668,17 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); v8::Local<v8::Value> module, \ v8::Local<v8::Context> context) +// Allows embedders to add a binding to the current Environment* that can be +// accessed through process._linkedBinding() in the target Environment and all +// Worker threads that it creates. +// In each variant, the registration function needs to be usable at least for +// the time during which the Environment exists. +NODE_EXTERN void AddLinkedBinding(Environment* env, const node_module& mod); +NODE_EXTERN void AddLinkedBinding(Environment* env, + const char* name, + addon_context_register_func fn, + void* priv); + /* Called after the event loop exits but before the VM is disposed. * Callbacks are run in reverse order of registration, i.e. newest first. * |