Comparing version 1.4.0-beta.2 to 1.4.0-beta.3
@@ -7,3 +7,2 @@ import { RegisterClientOptions, Resolvable } from './mqtt.types'; | ||
export declare enum StateId { | ||
Fatal = -1, | ||
Created = 0, | ||
@@ -30,3 +29,2 @@ Connecting = 1, | ||
get created(): boolean; | ||
get fatal(): boolean; | ||
get ready(): boolean; | ||
@@ -57,4 +55,3 @@ get connecting(): boolean; | ||
protected _setDisconnected(): void; | ||
protected setFatal(): void; | ||
private next; | ||
} |
@@ -8,3 +8,2 @@ "use strict"; | ||
(function (StateId) { | ||
StateId[StateId["Fatal"] = -1] = "Fatal"; | ||
StateId[StateId["Created"] = 0] = "Created"; | ||
@@ -32,5 +31,2 @@ StateId[StateId["Connecting"] = 1] = "Connecting"; | ||
} | ||
get fatal() { | ||
return this.current === StateId.Fatal; | ||
} | ||
get ready() { | ||
@@ -100,8 +96,4 @@ return this.current === StateId.Ready; | ||
} | ||
setFatal() { | ||
this.next(StateId.Fatal); | ||
} | ||
next(newState) { | ||
if (newState > this.current || | ||
(this.current === StateId.Fatal && newState === StateId.Disconnected) /* reconnect */) { | ||
if (newState > this.current) { | ||
this.sate = newState; | ||
@@ -108,0 +100,0 @@ } |
@@ -310,5 +310,5 @@ "use strict"; | ||
else { | ||
this.setFatal(); | ||
this.emitError(new errors_1.ConnectError(connAck.errorName)); | ||
this.setDisconnected(connAck.errorName).catch(e => this.emitWarning(e)); | ||
const error = new errors_1.ConnectError(connAck.errorName); | ||
this.setDisconnected(error).catch(e => this.emitWarning(e)); | ||
this.emitError(error); | ||
} | ||
@@ -315,0 +315,0 @@ } |
{ | ||
"name": "mqtts", | ||
"version": "1.4.0-beta.2", | ||
"version": "1.4.0-beta.3", | ||
"description": "MQTT client in Typescript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
169107
2531