Fix compile errors in TS code
These errors don't actually appear until bazel is upgraded.
Change-Id: I57886ce83432c4083f2d03bea60c658dd4f61ddb
diff --git a/tsconfig.json b/tsconfig.json
index 91093d3..d330268 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -2,7 +2,9 @@
"compilerOptions": {
"experimentalDecorators": true,
"strict": true,
- "noImplicitAny": false
+ "noImplicitAny": false,
+ "target": "es6",
+ "lib": ["es6", "dom"]
},
"bazelOptions": {
"workspaceName": "971-Robot-Code"
diff --git a/y2019/vision/server/www/main.ts b/y2019/vision/server/www/main.ts
index 5647d7b..9e90563 100644
--- a/y2019/vision/server/www/main.ts
+++ b/y2019/vision/server/www/main.ts
@@ -16,7 +16,7 @@
private targetX = 0;
private targetY = 0;
private targetTheta = 0;
- private cameraFrames : Frame[];
+ private cameraFrames : Frame[] = [];
private wrist: number = -1;
private elevator: number = -1;
@@ -42,12 +42,13 @@
const server = location.host;
this.initWebSocket(server);
- window.requestAnimationFrame(() => this.draw(ctx));
+ if (!!ctx) {
+ window.requestAnimationFrame(() => this.draw(ctx));
+ }
}
initWebSocket(server: string): void {
const socket = new WebSocket(`ws://${server}/ws`);
- this.cameraFrames = [];
socket.addEventListener('message', (event) => {
const j = JSON.parse(event.data);