You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IOW you write a native function that receives require() as a parameter. You can store a persistent reference to this function in your native addon and use it afterwards.
@elwyos how do you mean "and then accessing the variable blah"? There is nothing special about receiveRequire(). As long as you can get a reference to require() into your native addon, you're all set.
Closing this out as looks like the original question was answered and there has not been a response to Gabriel's last comment for a long time. Please let us know if that is not the right thing to do.
Activity
gabrielschulhof commentedon May 13, 2019
You can do this:
IOW you write a native function that receives
require()as a parameter. You can store a persistent reference to this function in your native addon and use it afterwards.gabrielschulhof commentedon Jun 4, 2019
@elwyos does this answer your question?
elwyos commentedon Jun 23, 2019
Sorry for the late reply - only checked this now. I've actually done something different instead :
blah = require; const addon = require('./build/Release/some_addon')and then accessing the variable
blah. That seems to work on the Init function. Is there anything special with receiveRequire?gabrielschulhof commentedon Jun 24, 2019
@elwyos how do you mean "and then accessing the variable
blah"? There is nothing special aboutreceiveRequire(). As long as you can get a reference torequire()into your native addon, you're all set.mhdawson commentedon Dec 7, 2020
Closing this out as looks like the original question was answered and there has not been a response to Gabriel's last comment for a long time. Please let us know if that is not the right thing to do.