hiddentao / gulp-server-livereload

Gulp plugin to run a local webserver with livereload enabled via socket.io. Also comes with standalone command-line interface.
MIT License
93 stars 28 forks source link

Fix chrome livereload #43

Closed akozhemiakin closed 7 years ago

akozhemiakin commented 7 years ago

Livereload does not work in chrome because of the illegal call to the window.console.log function. Log function in chrome is context aware (sensitive to the current value of 'this'). This commit fixes this chrome related bug by calling window.console.log directly, and hence in the right context.

sanbor commented 7 years ago

This issue is affecting Chrome users. Please merge. LGTM :+1:

hiddentao commented 7 years ago

This change was originally introduced in #41 by @SteffanDonal . I think a better fix would be:

var __consoleLog = window.console.log.bind(window.console);
var __log = function(msg) {
   __consoleLog('LIVERELOAD: ' + msg);
};
akozhemiakin commented 7 years ago

Done.

sanbor commented 7 years ago

Any update on this? Looks like @akozhemiakin applied the suggested change from @hiddentao.

hiddentao commented 7 years ago

Thanks

sanbor commented 7 years ago

Awesome, thank you!