forked from HackYourFuture/JavaScript3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepository.js
More file actions
26 lines (22 loc) · 760 Bytes
/
Repository.js
File metadata and controls
26 lines (22 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';
class Repository {
constructor(repository) {
this.repository = repository;
}
/**
* @param {HTMLElement} container The container element in which to render the repository.
*/
render(container) {
Util.createAndAppend('option', container, { text: this.name() });
}
fetchContributors() {
App.clearContainer(details);
Util.createAndAppend('div', details, { text: `Description: ${this.repository.description}` });
Util.createAndAppend('div', details, { text: `Forks: ${this.repository.forks}` });
Util.createAndAppend('div', details, { text: `Last Update: ${this.repository.updated_at}` });
return Util.fetchJSON(this.repository.contributors_url);
}
name() {
return this.repository.name;
}
}