mirror of
https://github.com/pion/webrtc.git
synced 2025-10-17 04:31:00 +08:00
Fix Codacy warnings
Run standardjs across all js files, fix all other issues by hand
This commit is contained in:
@@ -18,41 +18,39 @@ window.createDataChannel = name => {
|
||||
log(`${fullName}: has opened`)
|
||||
dc.onmessage = e => log(`${fullName}: '${e.data}'`)
|
||||
|
||||
let ul = document.getElementById("ul-open");
|
||||
let li = document.createElement('li');
|
||||
let ul = document.getElementById('ul-open')
|
||||
let li = document.createElement('li')
|
||||
li.appendChild(document.createTextNode(`${fullName}: `))
|
||||
|
||||
let btnSend = document.createElement("BUTTON")
|
||||
btnSend.appendChild(document.createTextNode("Send message"))
|
||||
|
||||
let btnSend = document.createElement('BUTTON')
|
||||
btnSend.appendChild(document.createTextNode('Send message'))
|
||||
btnSend.onclick = () => {
|
||||
let message = document.getElementById('message').value
|
||||
if (message === '') {
|
||||
return alert('Message must not be empty')
|
||||
}
|
||||
|
||||
|
||||
dc.send(message)
|
||||
}
|
||||
li.appendChild(btnSend)
|
||||
|
||||
let btnClose = document.createElement("BUTTON")
|
||||
btnClose.appendChild(document.createTextNode("Close"))
|
||||
let btnClose = document.createElement('BUTTON')
|
||||
btnClose.appendChild(document.createTextNode('Close'))
|
||||
btnClose.onclick = () => {
|
||||
dc.close()
|
||||
ul.removeChild(li)
|
||||
}
|
||||
li.appendChild(btnClose)
|
||||
|
||||
|
||||
dc.onclose = () => {
|
||||
log(`${fullName}: closed.`)
|
||||
ul.removeChild(li)
|
||||
}
|
||||
|
||||
ul.appendChild(li);
|
||||
ul.appendChild(li)
|
||||
}
|
||||
}
|
||||
|
||||
let sendChannel = window.createDataChannel('foo')
|
||||
|
||||
pc.oniceconnectionstatechange = e => log(`ICE state: ${pc.iceConnectionState}`)
|
||||
pc.onicecandidate = event => {
|
||||
if (event.candidate === null) {
|
||||
@@ -63,7 +61,6 @@ pc.onicecandidate = event => {
|
||||
pc.onnegotiationneeded = e =>
|
||||
pc.createOffer().then(d => pc.setLocalDescription(d)).catch(log)
|
||||
|
||||
|
||||
window.startSession = () => {
|
||||
let sd = document.getElementById('remoteSessionDescription').value
|
||||
if (sd === '') {
|
||||
|
Reference in New Issue
Block a user