Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,18 @@
handleSetNickname();
handleCreateMessage();
} catch (error) {
console.warn(`Ошибка в инициализации форм: ${error.message}`);

Check warning on line 127 in src/js/app.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 127 in src/js/app.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
}

try {
launchSSE();
launchWS();
} catch (error) {
console.warn('Ошибка в работе WS/SSE');

Check warning on line 134 in src/js/app.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 134 in src/js/app.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
}

window.addEventListener('beforeunload', () => {
console.log(GLOBAL_STATE.userName);

Check warning on line 138 in src/js/app.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 138 in src/js/app.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
if (!GLOBAL_STATE.userName) return;
SUBSCRIPTION.remove(GLOBAL_STATE.userName);
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/creatingElements.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const insertInChat = ({ element }) => {
};

export const changeNickname = ({ userName }) => {
if (GLOBAL_STATE.allUsers.every((i) => i !== userName)) throw new Error('юзера с данным именем нет в общем списке юзеров');
if (GLOBAL_STATE.allUsers.every((i) => i !== userName)) throw new Error('Юзера с данным именем нет в общем списке юзеров');

const subscribers = document.querySelectorAll('.subscription__item');
const currentUser = [...subscribers].find(
Expand Down
3 changes: 1 addition & 2 deletions src/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

export const launchSSE = () => {
SSE.addEventListener('open', (e) => {
console.log(e);

Check warning on line 11 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 11 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

SUBSCRIPTION.getSubscribers().then((result) => {
result
.map((item) => item.name)
.forEach((name) => {
setCompanion(name);
createNewSubscriber(name);
Expand Down Expand Up @@ -45,18 +44,18 @@
// console.log(response);
// });

console.log('sse open');

Check warning on line 47 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 47 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
});

SSE.addEventListener('error', (e) => {
console.log(e);

Check warning on line 51 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 51 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

console.log('sse error');

Check warning on line 53 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement

Check warning on line 53 in src/js/services.js

View workflow job for this annotation

GitHub Actions / build (20.x)

Unexpected console statement
});

SSE.addEventListener('message', (e) => {
const { name, deleteClient, add } = JSON.parse(e.data);

console.log(name, deleteClient, add);
if (add) {
setCompanion(name);
createNewSubscriber(name);
Expand Down
Loading