* Marks the operation as cancelled, clearing all callbacks and timeouts.
()
| 59 | * Marks the operation as cancelled, clearing all callbacks and timeouts. |
| 60 | */ |
| 61 | cancel() { |
| 62 | if (this._state !== state.init) { |
| 63 | return; |
| 64 | } |
| 65 | if (this._timeout !== null) { |
| 66 | clearTimeout(this._timeout); |
| 67 | } |
| 68 | this._state = state.cancelled; |
| 69 | this._callback = utils.noop; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Determines if the operation can be written to the wire (when it hasn't been cancelled or it hasn't timed out). |