本文整理匯總了TypeScript中stream.Duplex.destroy方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Duplex.destroy方法的具體用法?TypeScript Duplex.destroy怎麽用?TypeScript Duplex.destroy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stream.Duplex
的用法示例。
在下文中一共展示了Duplex.destroy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _closeSocket
/**
* Closes and destroys the underlying Socket. Emits an error event.
* @param err { String } An error string to include in error event.
*/
private _closeSocket(err: string) {
// Make sure only one 'error' event is fired for the lifetime of this SocksClient instance.
if (this.state !== SocksClientState.Error) {
// Set internal state to Error.
this.state = SocksClientState.Error;
// Destroy Socket
this._socket.destroy();
// Remove internal listeners
this.removeInternalSocketHandlers();
// Fire 'error' event.
this.emit('error', new SocksClientError(err, this._options));
}
}