Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-11-06 00:50:24 +0300
committerMyles Borins <mylesborins@google.com>2019-11-17 10:59:11 +0300
commitb744070d74c710ea884512cb2998e7f2bb837a2c (patch)
tree6c1b2f2774e523b503b1d8696cf1db0dbd4ae7c0 /src/node.h
parentde68720908bc783cadd811e84de7837fb4fa6759 (diff)
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.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h
index 8215552227a..7602d14ed7e 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.
*