need to add build, oops

This commit is contained in:
2026-04-23 08:48:53 -05:00
parent 3178bc63eb
commit 1159d9a459
+11 -2
View File
@@ -6,16 +6,25 @@ export class TetherClient {
this.websocketHandler.startConnection(url); this.websocketHandler.startConnection(url);
this.websocketHandler.onQuery = (location, data) => { this.websocketHandler.onQuery = (location, data) => {
if (location) { if (location) {
const callback = this.subscribedQueries.get(location); const { callback } = this.subscribedQueries.get(location) || { callback: () => { } };
callback?.(data); callback?.(data);
} }
}; };
this.websocketHandler.onOpen = () => {
this.subscribedQueries.forEach(({ params }, queryName) => {
this.websocketHandler.send(JSON.stringify({
type: 'subscribe',
location: queryName,
params: params
}));
});
};
}; };
disconnect = () => { disconnect = () => {
this.websocketHandler.close(); this.websocketHandler.close();
}; };
subscribe = (queryName, params, callback) => { subscribe = (queryName, params, callback) => {
this.subscribedQueries.set(queryName, callback); this.subscribedQueries.set(queryName, { callback, params });
this.websocketHandler.send(JSON.stringify({ this.websocketHandler.send(JSON.stringify({
type: 'subscribe', type: 'subscribe',
location: queryName, location: queryName,