Skip to content

Commit

Permalink
Remove arrow function syntax in hmr-runtime (#343)
Browse files Browse the repository at this point in the history
* Remove arrow function syntax in hmr-runtime

* Check 'WebSocket' for existence

* Fix typo
  • Loading branch information
saintwinkle authored and devongovett committed Dec 19, 2017
1 parent ac0fbaf commit 9f5b334
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/builtins/hmr-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Module() {

module.bundle.Module = Module;

if (!module.bundle.parent) {
if (!module.bundle.parent && typeof WebSocket !== 'undefined') {
var ws = new WebSocket('ws://localhost:{{HMR_PORT}}/');
ws.onmessage = function(event) {
var data = JSON.parse(event.data);
Expand All @@ -33,7 +33,7 @@ if (!module.bundle.parent) {

if (data.type === 'reload') {
ws.close();
ws.onclose = () => {
ws.onclose = function () {
window.location.reload();
}
}
Expand Down

0 comments on commit 9f5b334

Please sign in to comment.