From 6844ec4444d7e32d9e7b252bdfa5b4d95aa7284e Mon Sep 17 00:00:00 2001 From: karashiiro <49822414+karashiiro@users.noreply.github.com> Date: Thu, 27 May 2021 19:14:55 -0700 Subject: [PATCH] Add documentation comments --- create-card.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/create-card.js b/create-card.js index f1edeee..0d97b12 100644 --- a/create-card.js +++ b/create-card.js @@ -78,10 +78,20 @@ const infoTextBigStartY = infoTextSmallStartY + 25; const infoTextSpacing = 50; class CardCreator { + /** + * Creates a new card creator. + * @constructor + */ constructor() { 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() { if (this.isInit) { return; @@ -236,6 +246,11 @@ class CardCreator { 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} A promise representating the construction of the card's image data. + */ async createCard(charaId) { var response = await fetch(`https://xivapi.com/character/${charaId}?extended=1&data=FC,mimo`); var data = await response.json();