Skip to content

Conversation

@NikitaKir98
Copy link
Contributor

@NikitaKir98 NikitaKir98 commented Jun 18, 2025

@keksobot keksobot changed the title выполнил дз 11 модуля Надо подкачаться Jun 18, 2025
}
};

function onDocumentKeydown (evt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть ли необходимость в function? Можно использовать стрелочную функцию?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

}
};

function onDocumentKeydown (evt) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Функции в модулях повторяются - может объединить в один модуль и переиспользовать функции?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

объединил в модуле utils и импортировал

@@ -0,0 +1,31 @@
const BASE_URL = 'https://32.Javascript.htmlacademy.pro/kekstagram';
const Route = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С заглавной буквы именуем класс или компонент. Подобные константы, обычно именуются в UPPER_CASE стиле

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в курсе пишется, что обьект с константами пишется так же с большой буквы

js/main.js Outdated
@@ -1,5 +1,4 @@
import { renderThumbnails } from './thumbnail_render.js';
import './thumbnail_render.js';
import './photo_upload_form.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Импортировать необходимо функцию/функции и их запускать. Так действие будет более предсказуемым. Это важно для всех импортов.

Без имени импортируем только сторонние библиотеки, если это предусмотрено их документацией. Например, бутстрап

import { showAlertSucces } from './alert-success.js';
import {showAlertError} from './alert-error.js';

const GET_ERROR_TAGS = 'tags';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это именование полезно обсудить. У констант не ожидается глагол.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправил

setTimeout(removePopup, 5000);
};

function removePopup(){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стрелочная функция возможна в этом месте?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

поправил

@@ -1,8 +1,9 @@
import { createDescriptionPhoto } from './data.js';
import {openPost} from './post.js';
import {showPopup} from './popup-error.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

надо проверить линтер и его правила. В части модулей есть пробелы между скобок, здесь нет

picturesContainer.append(fragment);
};

getData()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Действие выполнится при импорте функций из модуля. В последовательности кода не будет места загрузки данных и найти это место будет сложно.

Название модуля "рендер" - значит он не про загрузку, а про отображение

Где-то ранее, например в модуле инициализации, выполняется загрузка данных и при успехе вызывается рендер.

@ILokalin ILokalin merged commit 13ea4e4 into htmlacademy-javascript:master Jun 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants