Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hotrequire

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hotrequire

Extends require object by adding the require.hot(path, callback) method. This enables you to hot-load modules into the current scope.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 29 Sep 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc