
Invalidate Node.js modules and make them automatically reloaded - Franck-F
https://github.com/FranckFreiburger/module-invalidate
======
Franck-F
Example:

Module ./myModule.js:

    
    
        module.invalidable = true;
        var count = 0;
        exports.count = function() {
            return count++;
        }
    
    

Main module ./index.js:

    
    
        require('module-invalidate');
        
        var myModule = require('./myModule.js');
        
        console.log( myModule.count() ); // 0
        console.log( myModule.count() ); // 1
        
        module.constructor.invalidateByExports(myModule);
        
        console.log( myModule.count() ); // 0
        console.log( myModule.count() ); // 1

