/* eslint-env browser */ import { Event, Observable } from "./Observable.js"; import WebSocketClient from "./WebSocketClient.js"; class GazeClient extends Observable { constructor() { super(); } connect(url) { this.url = url; this.client = new WebSocketClient(); this.client.addEventListener("connected", this.onConnected.bind(this)); this.client.addEventListener("gazeDataAvailable", this.onGazeDataAvailable .bind(this)); this.client.connect(url); } onOpen() { this.client.send("hello server"); } onConnected(event) { // TODO: Implement event broadcasting } onGazeDataAvailable(event) { this.notifyAll(event); } } window.GazeClient = GazeClient;