add options to reload function

if `cwd` is included in option, reload will not work
This commit is contained in:
Fuxian Ding 2014-12-27 12:48:24 +08:00
parent ae04cc9a4a
commit 1f1442cb7c

View File

@ -248,12 +248,12 @@ function configureOnceOff(config, options) {
} }
} }
function reloadConfiguration() { function reloadConfiguration(options) {
var mtime = getMTime(configState.filename); var mtime = getMTime(configState.filename);
if (!mtime) return; if (!mtime) return;
if (configState.lastMTime && (mtime.getTime() > configState.lastMTime.getTime())) { if (configState.lastMTime && (mtime.getTime() > configState.lastMTime.getTime())) {
configureOnceOff(loadConfigurationFile(configState.filename)); configureOnceOff(loadConfigurationFile(configState.filename), options);
} }
configState.lastMTime = mtime; configState.lastMTime = mtime;
} }
@ -275,7 +275,7 @@ function initReloadConfiguration(filename, options) {
} }
configState.filename = filename; configState.filename = filename;
configState.lastMTime = getMTime(filename); configState.lastMTime = getMTime(filename);
configState.timerId = setInterval(reloadConfiguration, options.reloadSecs*1000); configState.timerId = setInterval(reloadConfiguration, options.reloadSecs*1000, options);
} }
function configure(configurationFileOrObject, options) { function configure(configurationFileOrObject, options) {