Add documentation comments
This commit is contained in:
parent
a1976a6092
commit
6844ec4444
1 changed files with 15 additions and 0 deletions
|
@ -78,10 +78,20 @@ const infoTextBigStartY = infoTextSmallStartY + 25;
|
||||||
const infoTextSpacing = 50;
|
const infoTextSpacing = 50;
|
||||||
|
|
||||||
class CardCreator {
|
class CardCreator {
|
||||||
|
/**
|
||||||
|
* Creates a new card creator.
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.isInit = false;
|
this.isInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures that the instance is ready to generate character cards.
|
||||||
|
* This function should be called before using character card
|
||||||
|
* generation methods.
|
||||||
|
* @returns {Promise} A promise representing the initialization state of this generator.
|
||||||
|
*/
|
||||||
async ensureInit() {
|
async ensureInit() {
|
||||||
if (this.isInit) {
|
if (this.isInit) {
|
||||||
return;
|
return;
|
||||||
|
@ -236,6 +246,11 @@ class CardCreator {
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a character card for a character.
|
||||||
|
* @param {number | string} charaId The Lodestone ID of the character to generate a card for.
|
||||||
|
* @returns {Promise<Buffer>} A promise representating the construction of the card's image data.
|
||||||
|
*/
|
||||||
async createCard(charaId) {
|
async createCard(charaId) {
|
||||||
var response = await fetch(`https://xivapi.com/character/${charaId}?extended=1&data=FC,mimo`);
|
var response = await fetch(`https://xivapi.com/character/${charaId}?extended=1&data=FC,mimo`);
|
||||||
var data = await response.json();
|
var data = await response.json();
|
||||||
|
|
Loading…
Reference in a new issue