1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Apply prettier formatting

This commit is contained in:
Michael Weimann
2022-12-09 09:38:20 +01:00
parent 08a9073bd5
commit 349c2c2587
239 changed files with 22004 additions and 21928 deletions

View File

@ -9,7 +9,7 @@ const client = matrixcs.createClient({
baseUrl: BASE_URL,
accessToken: TOKEN,
userId: USER_ID,
deviceId: DEVICE_ID
deviceId: DEVICE_ID,
});
let call;
@ -21,18 +21,16 @@ function disableButtons(place, answer, hangup) {
function addListeners(call) {
let lastError = "";
call.on("hangup", function() {
call.on("hangup", function () {
disableButtons(false, true, true);
document.getElementById("result").innerHTML = (
"<p>Call ended. Last error: "+lastError+"</p>"
);
document.getElementById("result").innerHTML = "<p>Call ended. Last error: " + lastError + "</p>";
});
call.on("error", function(err) {
call.on("error", function (err) {
lastError = err.message;
call.hangup();
disableButtons(false, true, true);
});
call.on("feeds_changed", function(feeds) {
call.on("feeds_changed", function (feeds) {
const localFeed = feeds.find((feed) => feed.isLocal());
const remoteFeed = feeds.find((feed) => !feed.isLocal());
@ -51,33 +49,38 @@ function addListeners(call) {
});
}
window.onload = function() {
window.onload = function () {
document.getElementById("result").innerHTML = "<p>Please wait. Syncing...</p>";
document.getElementById("config").innerHTML = "<p>" +
"Homeserver: <code>"+BASE_URL+"</code><br/>"+
"Room: <code>"+ROOM_ID+"</code><br/>"+
"User: <code>"+USER_ID+"</code><br/>"+
document.getElementById("config").innerHTML =
"<p>" +
"Homeserver: <code>" +
BASE_URL +
"</code><br/>" +
"Room: <code>" +
ROOM_ID +
"</code><br/>" +
"User: <code>" +
USER_ID +
"</code><br/>" +
"</p>";
disableButtons(true, true, true);
};
client.on("sync", function(state, prevState, data) {
client.on("sync", function (state, prevState, data) {
switch (state) {
case "PREPARED":
syncComplete();
break;
}
syncComplete();
break;
}
});
function syncComplete() {
document.getElementById("result").innerHTML = "<p>Ready for calls.</p>";
disableButtons(false, true, true);
document.getElementById("call").onclick = function() {
document.getElementById("call").onclick = function () {
console.log("Placing call...");
call = matrixcs.createNewMatrixCall(
client, ROOM_ID
);
call = matrixcs.createNewMatrixCall(client, ROOM_ID);
console.log("Call => %s", call);
addListeners(call);
call.placeVideoCall();
@ -85,14 +88,14 @@ function syncComplete() {
disableButtons(true, true, false);
};
document.getElementById("hangup").onclick = function() {
document.getElementById("hangup").onclick = function () {
console.log("Hanging up call...");
console.log("Call => %s", call);
call.hangup();
document.getElementById("result").innerHTML = "<p>Hungup call.</p>";
};
document.getElementById("answer").onclick = function() {
document.getElementById("answer").onclick = function () {
console.log("Answering call...");
console.log("Call => %s", call);
call.answer();
@ -100,7 +103,7 @@ function syncComplete() {
document.getElementById("result").innerHTML = "<p>Answered call.</p>";
};
client.on("Call.incoming", function(c) {
client.on("Call.incoming", function (c) {
console.log("Call ringing");
disableButtons(true, false, false);
document.getElementById("result").innerHTML = "<p>Incoming call...</p>";