Skip to content

Commit

Permalink
refactor: small simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Keuklar committed Apr 30, 2024
1 parent b168cec commit badf8c1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/content/datachannel/basic/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,12 @@ function onReceiveMessageCallback(event) {
function onSendChannelStateChange() {
const readyState = sendChannel.readyState;
console.log('Send channel state is: ' + readyState);
if (readyState === 'open') {
dataChannelSend.disabled = false;
const closed = readyState !== 'open'
dataChannelSend.disabled = closed;
sendButton.disabled = closed;
closeButton.disabled = closed;
if (!closed) {
dataChannelSend.focus();
sendButton.disabled = false;
closeButton.disabled = false;
} else {
dataChannelSend.disabled = true;
sendButton.disabled = true;
closeButton.disabled = true;
}
}

Expand Down

0 comments on commit badf8c1

Please sign in to comment.