diff options
Diffstat (limited to 'ext/js/language')
-rw-r--r-- | ext/js/language/dictionary-importer-media-loader.js | 9 | ||||
-rw-r--r-- | ext/js/language/dictionary-worker-media-loader.js | 9 | ||||
-rw-r--r-- | ext/js/language/translator.js | 10 |
3 files changed, 21 insertions, 7 deletions
diff --git a/ext/js/language/dictionary-importer-media-loader.js b/ext/js/language/dictionary-importer-media-loader.js index 69a27f71..ce03ab20 100644 --- a/ext/js/language/dictionary-importer-media-loader.js +++ b/ext/js/language/dictionary-importer-media-loader.js @@ -21,9 +21,12 @@ class DictionaryImporterMediaLoader { /** * Attempts to load an image using an ArrayBuffer and a media type to return details about it. - * @param content The binary content for the image, encoded as an ArrayBuffer. - * @param mediaType The media type for the image content. - * @returns A Promise which resolves with {content, width, height} on success, otherwise an error is thrown. + * @param {ArrayBuffer} content The binary content for the image, encoded as an ArrayBuffer. + * @param {string} mediaType The media type for the image content. + * @param {Transferable[]} [transfer] An optional array of data that should be transferred in `postMessage` calls. + * When the resulting promise resolves, this array will contain the `content` object. + * @returns {Promise<{content: ArrayBuffer, width: number, height: number}>} Details about the requested image content. + * @throws {Error} An error can be thrown if the image fails to load. */ getImageDetails(content, mediaType, transfer) { return new Promise((resolve, reject) => { diff --git a/ext/js/language/dictionary-worker-media-loader.js b/ext/js/language/dictionary-worker-media-loader.js index fc7ecd17..7e30b333 100644 --- a/ext/js/language/dictionary-worker-media-loader.js +++ b/ext/js/language/dictionary-worker-media-loader.js @@ -29,7 +29,7 @@ class DictionaryWorkerMediaLoader { /** * Handles a response message posted to the worker thread. - * @param params Details of the response. + * @param {{id: string, error: object|undefined, result: any|undefined}} params Details of the response. */ handleMessage(params) { const {id} = params; @@ -46,9 +46,10 @@ class DictionaryWorkerMediaLoader { /** * Attempts to load an image using an ArrayBuffer and a media type to return details about it. - * @param content The binary content for the image, encoded as an ArrayBuffer. - * @param mediaType The media type for the image content. - * @returns A Promise which resolves with {content, width, height} on success, otherwise an error is thrown. + * @param {ArrayBuffer} content The binary content for the image, encoded as an ArrayBuffer. + * @param {string} mediaType The media type for the image content. + * @returns {Promise<{content: ArrayBuffer, width: number, height: number}>} Details about the requested image content. + * @throws {Error} An error can be thrown if the image fails to load. */ getImageDetails(content, mediaType) { return new Promise((resolve, reject) => { diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js index fafd1bfb..73f27ff9 100644 --- a/ext/js/language/translator.js +++ b/ext/js/language/translator.js @@ -26,6 +26,16 @@ */ class Translator { /** + * Information about how popup content should be shown, specifically related to the outer popup frame. + * @typedef {object} TermFrequency + * @property {string} term The term. + * @property {string} reading The reading of the term. + * @property {string} dictionary The name of the dictionary that the term frequency originates from. + * @property {boolean} hasReading Whether or not a reading was specified. + * @property {number|string} frequency The frequency value for the term. + */ + + /** * Creates a new Translator instance. * @param {object} details The details for the class. * @param {JapaneseUtil} details.japaneseUtil An instance of JapaneseUtil. |