Use Array.prototype.indexOf instead of Array.prototype.includes to support IE

This commit is contained in:
Ryan Castner 2020-04-08 11:27:37 -04:00
parent 5e72400c5a
commit 8f28e062fd
1 changed files with 3 additions and 3 deletions

View File

@ -159,7 +159,7 @@ export default class WebChannel {
// Send Queue
flush() {
if (this._sQlen > 0 && ReadyStates.OPEN.includes(this._rawChannel.readyState)) {
if (this._sQlen > 0 && ReadyStates.OPEN.indexOf(this._rawChannel.readyState) >= 0) {
this._rawChannel.send(this._encode_message());
this._sQlen = 0;
}
@ -238,8 +238,8 @@ export default class WebChannel {
close() {
if (this._rawChannel) {
if ((ReadyStates.CONNECTING.includes(this._rawChannel.readyState)) ||
(ReadyStates.OPEN.includes(this._rawChannel.readyState))) {
if (ReadyStates.CONNECTING.indexOf(this._rawChannel.readyState) >= 0 ||
ReadyStates.OPEN.indexOf(this._rawChannel.readyState) >= 0) {
Log.Info(`Closing WebChannel connection`);
this._rawChannel.close();
}