mirror of
https://github.com/wisplite/tether-ts.git
synced 2026-05-01 06:22:41 -05:00
small update
This commit is contained in:
Vendored
+1
-1
@@ -3,7 +3,7 @@ export declare class TetherClient {
|
|||||||
private subscribedQueries;
|
private subscribedQueries;
|
||||||
connect: (url: string) => void;
|
connect: (url: string) => void;
|
||||||
disconnect: () => void;
|
disconnect: () => void;
|
||||||
subscribe: (query: string, callback: (data: any) => void) => void;
|
subscribe: (queryName: string, params: any, callback: (data: any) => void) => void;
|
||||||
unsubscribe: (query: string) => void;
|
unsubscribe: (query: string) => void;
|
||||||
sendMutation: (mutationName: string, params: any) => void;
|
sendMutation: (mutationName: string, params: any) => void;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+5
-4
@@ -14,11 +14,12 @@ export class TetherClient {
|
|||||||
disconnect = () => {
|
disconnect = () => {
|
||||||
this.websocketHandler.close();
|
this.websocketHandler.close();
|
||||||
};
|
};
|
||||||
subscribe = (query, callback) => {
|
subscribe = (queryName, params, callback) => {
|
||||||
this.subscribedQueries.set(query, callback);
|
this.subscribedQueries.set(queryName, callback);
|
||||||
this.websocketHandler.send(JSON.stringify({
|
this.websocketHandler.send(JSON.stringify({
|
||||||
type: 'subscribe',
|
type: 'subscribe',
|
||||||
query: query
|
location: queryName,
|
||||||
|
params: params
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
unsubscribe = (query) => {
|
unsubscribe = (query) => {
|
||||||
@@ -32,7 +33,7 @@ export class TetherClient {
|
|||||||
this.websocketHandler.send(JSON.stringify({
|
this.websocketHandler.send(JSON.stringify({
|
||||||
type: 'mutation',
|
type: 'mutation',
|
||||||
name: mutationName,
|
name: mutationName,
|
||||||
payload: params,
|
params: params,
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -17,11 +17,12 @@ export class TetherClient {
|
|||||||
this.websocketHandler.close();
|
this.websocketHandler.close();
|
||||||
};
|
};
|
||||||
|
|
||||||
subscribe = (query: string, callback: (data: any) => void) => {
|
subscribe = (queryName: string, params: any, callback: (data: any) => void) => {
|
||||||
this.subscribedQueries.set(query, callback);
|
this.subscribedQueries.set(queryName, callback);
|
||||||
this.websocketHandler.send(JSON.stringify({
|
this.websocketHandler.send(JSON.stringify({
|
||||||
type: 'subscribe',
|
type: 'subscribe',
|
||||||
query: query
|
location: queryName,
|
||||||
|
params: params
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ export class TetherClient {
|
|||||||
this.websocketHandler.send(JSON.stringify({
|
this.websocketHandler.send(JSON.stringify({
|
||||||
type: 'mutation',
|
type: 'mutation',
|
||||||
name: mutationName,
|
name: mutationName,
|
||||||
payload: params,
|
params: params,
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user