mirror of
https://github.com/wisplite/tether-ts.git
synced 2026-05-01 06:22:41 -05:00
fixed a shadowing bug
This commit is contained in:
+6
-5
@@ -52,14 +52,15 @@ export class TetherClient {
|
|||||||
mutation_id: mutation_id
|
mutation_id: mutation_id
|
||||||
}));
|
}));
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.websocketHandler.onMutation = (mutation_id: string, data: any) => {
|
const timeoutId = setTimeout(() => {
|
||||||
if (mutation_id === mutation_id) {
|
reject(new Error('Mutation timeout'));
|
||||||
|
}, 10000);
|
||||||
|
this.websocketHandler.onMutation = (incoming_id: string, data: any) => {
|
||||||
|
if (incoming_id === mutation_id) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
resolve(data);
|
resolve(data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setTimeout(() => {
|
|
||||||
reject(new Error('Mutation timeout'));
|
|
||||||
}, 10000);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user