delete require.cache[the_absolute path_of_module];
 
is it what you want? 

On Thursday, June 14, 2012 3:40:55 AM UTC+8, Andrew Finnell wrote:

> I did some research in the group and it appears someone had a similar 
> question about unloading modules that were loaded with require.
>
> Am I correct in reading that the use of nodules would allow me to 
> require('./module1') then dump the entire contents of that 
> module programmaticly at a later time? Then reload it if I felt like it, 
> all within the same node process.
>
> It seems I could build a simple app server with dynamic modules can be 
> done like so:
>
> I have this working pretty well except for the unloading piece. Is this 
> possible or do I have to find a mechanism to bounce the nodes?
>
>
> var loadedModules = {};
>
> on('load', function(moduleName) {
>    var module = require(moduleName);
>    module.start();
>    loadedModules[ moduleName ] = module;
> });
>
> on('unload', function(moduleName) {
>      // unload here..     
> });
>
> I completely realize that I am oversimplifying so I am hoping to get 
> straightened out.
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to