Skip to content

Instantly share code, notes, and snippets.

@koras
Created February 14, 2020 22:22
Show Gist options
  • Save koras/f16ddf4c41391a5167e0edbb7d64625c to your computer and use it in GitHub Desktop.
Save koras/f16ddf4c41391a5167e0edbb7d64625c to your computer and use it in GitHub Desktop.
class CardList {
constructor(element) {
this.list = [];
this.element = element;
}
/**
* генерируем карточки
* @param {*} initialCard
*/
render(initialCard) {
for (const elCard of initialCard) {
const card = new Card();
const html = card.render(elCard);
this.list.push(card);
}
}
/**
* Добавляем в DOM
* @param {*} html
*/
addHtml(html) {
this.element.insertAdjacentHTML('afterend', html);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment