mirror of
https://github.com/wisplite/tether-ts.git
synced 2026-05-01 06:22:41 -05:00
ahhhh
This commit is contained in:
Vendored
+12
@@ -39,10 +39,22 @@ export class TetherClient {
|
||||
}));
|
||||
};
|
||||
sendMutation = (mutationName, params) => {
|
||||
const mutation_id = crypto.randomUUID();
|
||||
this.websocketHandler.send(JSON.stringify({
|
||||
type: 'mutation',
|
||||
location: mutationName,
|
||||
params: params,
|
||||
mutation_id: mutation_id
|
||||
}));
|
||||
return new Promise((resolve, reject) => {
|
||||
this.websocketHandler.onMutation = (data) => {
|
||||
if (data.mutation_id === mutation_id) {
|
||||
resolve(data);
|
||||
}
|
||||
};
|
||||
setTimeout(() => {
|
||||
reject(new Error('Mutation timeout'));
|
||||
}, 10000);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user