* Produces an ack callback to emit with an event. * * @private
(id: number)
| 783 | * @private |
| 784 | */ |
| 785 | private ack(id: number): (...args: any[]) => void { |
| 786 | const self = this; |
| 787 | let sent = false; |
| 788 | return function (...args: any[]) { |
| 789 | // prevent double callbacks |
| 790 | if (sent) return; |
| 791 | sent = true; |
| 792 | debug("sending ack %j", args); |
| 793 | |
| 794 | self.packet({ |
| 795 | type: PacketType.ACK, |
| 796 | id: id, |
| 797 | data: args, |
| 798 | }); |
| 799 | }; |
| 800 | } |
| 801 | |
| 802 | /** |
| 803 | * Called upon a server acknowledgement. |
no test coverage detected