vohof/gulp-livereload — pull request #29 by ifraixedes (2014-06-08 14:19:42+00:00)
Title: Full reload notification - new overloaded `changed` signature

After used this gulp plugin I've found a use case which I have to refresh the whole page whenever I make a change.

I tried to use the plugin to send a notification to tiny live reload service when in a `gulp.watch` a receive a changed file notification which I have to rerun a defined `gulp.task`. Due that `gulp.watch` doesn't have a function signature which allows to run a defined tasks and when they finish, call a callback, in the same way that exist a function signature to call a callback whenever a file change is detected, I need to call `livereload.changed()` from the defined gulp task, to notify to `tiny-lr` server and get an auto page reload.

I tried to do the same operation adding to `gulp.watch` tasks with the same `glob` , and it should work if it doesn't matter if the reload have to be before the any task ends or after, but in my case I want to notify the reload when the task is done otherwise the reload refreshes the page before the change has been done and I see the old page.

My use case is, whenever I change a server file (route, model, etc.), I want to run a task which restart the server to get the server side changes and notify a reload when the server has been restarted and ready to receive requests. Because the server restart task is a asynchronous, I need to call `livereload.changed()` from that task just before calling `next()`, but not before (something that happens if I register to `gulp.watch` with the same `glob`) to be able that the response will bring the new changes.

The change that I requesting, assign and `'*'` to `filePath` variable, but it isn't a requirement for `tiny-lr` server to send that value; the only requirement to notify a page reload is send `files` query parameters with some value (empty array is considered as no parameter or value, therefore, `tiny-lr` doesn't send to the client the reload command). I decided to send a ``'*'` because, from my point of view, the debug message make sense, however, it has been just my own opinion and it can be whatever else.