From 4f6ef99ba6d4bd7d17ed3022db0e8a861218e3a9 Mon Sep 17 00:00:00 2001 From: goliatone Date: Sat, 18 Apr 2015 12:50:25 -0400 Subject: [PATCH] Added settimeout to watch reload --- lib/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 81c0966..a1943c3 100644 --- a/lib/index.js +++ b/lib/index.js @@ -49,7 +49,9 @@ module.exports = function(root, opts) { // when a file is modifed tell all clients to reload it watcher.on('change', function(file) { - fn.reload(urlsByFile[file]) + setTimeout(function(){ + fn.reload(urlsByFile[file]) + }, opts.delay || 0); }) // build a RegExp to match all watched file extensions