From 07a26a256842314156ef7fa5ab0562412e190d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Wed, 3 Jun 2015 14:45:45 +0800 Subject: [PATCH] Added deCache support --- package.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.js b/package.js index 814e204..b19a13d 100644 --- a/package.js +++ b/package.js @@ -13,7 +13,7 @@ Package.prototype.rootNS = function( name, path ) rootNS[ name ] = fs.realpathSync( path ) + "/"; }; -Package.prototype.load = function( _class ) +Package.prototype.load = function( _class, deCache ) { var fSep = _class.indexOf( "." ); var nsdomain = _class.substr( 0, fSep ); @@ -24,6 +24,10 @@ Package.prototype.load = function( _class ) var lClass = require( file ); // TODO: Implements filewatcher + if( deCache ) + { + delete require.cache[ require.resolve( file ) ]; + } return lClass; };