Skip to content

Commit

Permalink
Remove debugging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ToranSharma committed May 19, 2020
1 parent ce3d492 commit b586010
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Changelog
### Changed
- Content script renamed from script.js to xporcle.js.

### Removed
- Debugging console messages from content and background scripts.

[v0.0.1] - 2020-05-18
---------------------
Expand Down
11 changes: 0 additions & 11 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,14 @@ let playing = null;
chrome.runtime.onConnect.addListener(
(port) =>
{
console.log("Page connecting");
if (port.name === "messageRelay")
{
messagePort = port;
port.onMessage.addListener(
(message) =>
{
console.log("Page sent a message");
console.log(message);
if (message.type === "connectionStatus")
{
console.log("Page is asking about the connection status");
// Request to see if we are still connected to a room
if (ws !== null)
{
Expand Down Expand Up @@ -94,11 +90,8 @@ chrome.runtime.onConnect.addListener(
port.onDisconnect.addListener(
() =>
{
console.log("page disconnected");
messagePort = null;

console.log("playing: ", playing);

if (playing)
{
playing = false;
Expand All @@ -114,8 +107,6 @@ chrome.runtime.onConnect.addListener(

function startConnection(initialMessage)
{
console.log("Connecting to server");

username = initialMessage.username;

if (initialMessage["code"] !== undefined)
Expand All @@ -131,7 +122,6 @@ function startConnection(initialMessage)
};
ws.onclose = (event) =>
{
console.log("connection closed");
if (messagePort != null)
messagePort.postMessage({type: "connection_closed"});
reset();
Expand All @@ -147,7 +137,6 @@ function startConnection(initialMessage)
function forwardMessage(event)
{
const message = JSON.parse(event.data);
console.log(message);

messageType = message["type"];

Expand Down
17 changes: 1 addition & 16 deletions xporcle.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ function resetInterface()

function processMessage(message)
{
console.log(message);

messageType = message["type"];

switch (messageType)
Expand All @@ -204,22 +202,16 @@ function processMessage(message)
updateLeaderboard(message["scores"]);
break;
case "room_closed":
console.log("room closed");
resetInterface();
break;
case "connection_closed":
console.log("server connection closed");
resetInterface();
break;
case "rooms_list":
console.log(message["rooms"]);
break;
case "error":
console.error(message["error"]);
break;
case "removed_from_room":
const removedUser = message["username"];
console.log(`${removedUser} removed from room`);
if (removedUser === username)
{
resetInterface();
Expand Down Expand Up @@ -301,8 +293,6 @@ async function createRoom(event, form)
return;
}

console.log("connection established.");

try
{
await navigator.clipboard.writeText(roomCode);
Expand All @@ -311,7 +301,7 @@ async function createRoom(event, form)
{
console.error("Clipboard write failure: ", error);
}

/* clipboard-write permissions query is only available in chrome
await navigator.permissions.query({name: "clipboard-write"}).then(
(result) =>
Expand Down Expand Up @@ -345,8 +335,6 @@ async function joinRoom(event, form)
button.disabled = true;
button.value = "...";

console.log(`Trying to join room ${roomCode}`);

const message = {
type: "join_room",
username: username,
Expand Down Expand Up @@ -391,7 +379,6 @@ async function joinRoom(event, form)
return;
}

console.log("connection established");
onRoomConnect();
}

Expand Down Expand Up @@ -820,7 +807,6 @@ function quizStarted(mutationList)
{
// Quiz started
quizStartObserver.disconnect();
console.log("Quiz started");

quizRunning = true;
quizStartTime = new Date();
Expand Down Expand Up @@ -852,7 +838,6 @@ function quizFinished(mutationList)
if (mutation.target.getAttribute("style") !== null)
{
// Quiz finished
console.log("Quiz finished");

quizFinishObserver.disconnect();
scoreObserver.disconnect();
Expand Down

0 comments on commit b586010

Please sign in to comment.