private void Reconfigure() { IDisposable oldpool; using (var cfg = new ReactConfiguration()) { Configure(cfg); lock (this) { if (watcher != null) { watcher.StopNotify(); } oldpool = (IDisposable)_ReactPool; _ReactPool = cfg.GetReactPool(); watcher = cfg.Watcher; Preprocessor = cfg.PreprocessorFunction; Postprocessor = cfg.PostprocessorFunction; if (watcher != null) { watcher.StartNotify(this.Reconfigure); } } } if (oldpool != null) { oldpool.Dispose(); } }
public void WatchDirectory(string path, TimeSpan gracePeriod) { if (Watcher != null) { throw new ApplicationException("you can attach only one directory to be watched for changes"); } Watcher = new ScriptsWatcher(path, gracePeriod); Watcher.EnumerateJsAndJsx(this); }