(function () { 'use strict'; /* eslint-env browser */ function onOpen(event) { this.callback("Connection open"); } function onMessage(event) { console.log(event); } class WebSocketClient { constructor(url, callback) { this.callback = callback; this.ws = new WebSocket(url); this.ws.onopen = onOpen.bind(this); this.ws.onmessage = onMessage.bind(this); } send(msg) { this.ws.send(msg); } } /* eslint-env browser */ class GazeClient { connect(url) { this.url = url; this.client = new WebSocketClient(url, this.onOpen.bind(this)); } onOpen() { this.client.send("hello server"); } } window.GazeClient = GazeClient; }());