From 3de89ab16c320350f20c828763b11a47cf2a2807 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 29 Feb 2016 02:57:35 +0100 Subject: web: use es6 modules --- web/src/js/connection.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'web/src/js/connection.js') diff --git a/web/src/js/connection.js b/web/src/js/connection.js index 5e229b6e..6177938e 100644 --- a/web/src/js/connection.js +++ b/web/src/js/connection.js @@ -1,6 +1,6 @@ -var actions = require("./actions.js"); -var AppDispatcher = require("./dispatcher.js").AppDispatcher; +import {ConnectionActions, EventLogActions} from "./actions.js"; +import {AppDispatcher} from "./dispatcher.js"; function Connection(url) { if (url[0] === "/") { @@ -9,21 +9,21 @@ function Connection(url) { var ws = new WebSocket(url); ws.onopen = function () { - actions.ConnectionActions.open(); + ConnectionActions.open(); }; ws.onmessage = function (message) { var m = JSON.parse(message.data); AppDispatcher.dispatchServerAction(m); }; ws.onerror = function () { - actions.ConnectionActions.error(); - actions.EventLogActions.add_event("WebSocket connection error."); + ConnectionActions.error(); + EventLogActions.add_event("WebSocket connection error."); }; ws.onclose = function () { - actions.ConnectionActions.close(); - actions.EventLogActions.add_event("WebSocket connection closed."); + ConnectionActions.close(); + EventLogActions.add_event("WebSocket connection closed."); }; return ws; } -module.exports = Connection; \ No newline at end of file +export default Connection; \ No newline at end of file -- cgit v1.2.3