Skip to content

SparkPost/hotrequire

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hotRequire

hotRequire hot-loads modules by extending the system's require() function using the fs.fileWatch() routine (which already comes with node).
Hot-loading means it watches the file for changes and then reloades it's eval'd content into the variable set by the user.

Important: It does NOT rewrite the require(); method rahter than utilizing and extending it.

The file watcher emits catchable events to the process. These events are "modified", "removed" and "reloaded".

Usage

var hotrequire = require('./hotrequire.js');

var example = hotrequire('./example.js', function(module) {
	example = module
});

// or

var example = require.hot('./example.js', function(module) {
	example = module
});

console.log(example.message);

Requirements

  • fs.js & node-waf & v8.h (Comes with node)

Installation

npm install hotrequire

About

hot load modules into node.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%