Skip to content

Commit

Permalink
📝 Update jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Jun 13, 2024
1 parent be7bcea commit 8cda872
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions src/js/Aladin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2154,15 +2154,16 @@ aladin.on("positionChanged", ({ra, dec}) => {
};

/**
* Return the current view as a data URL (base64-formatted string)
* Parameters:
* - options (optional): object with attributs
* * format (optional): 'image/png' or 'image/jpeg'
* * width: width in pixels of the image to output
* * height: height in pixels of the image to output
* * logo (optional): boolean to display the Aladin Lite logo
* Return the current view as a png data URL (base64-formatted string)
*
* @API
* @memberof Aladin
*
* @param {Object} [options] Object with attributs, options are:
* @param {Object} [options.format] 'image/png' or 'image/jpeg'
* @param {Object} options.width Width in pixels of the image to output
* @param {Object} options.height Height in pixels of the image to output
* @param {Object} [options.logo=true] Boolean to display the Aladin Lite logo
* @returns {Promise<string>} The image as a png data URL
*/
Aladin.prototype.getViewDataURL = async function (options) {
var options = options || {};
Expand All @@ -2182,34 +2183,34 @@ aladin.on("positionChanged", ({ra, dec}) => {

/**
* Return the current view as a png ArrayBuffer
* Parameters :
* - withLogo (optional): boolean to display the Aladin Lite logo
*
* @API
* @memberof Aladin
*
* @param {boolean} withLogo Display or not the Aladin Lite logo
* @returns {Promise<ArrayBuffer>} The image as a png ArrayBuffer
*/
Aladin.prototype.getViewArrayBuffer = async function (withLogo) {
return await this.view.getCanvasArrayBuffer("image/png", null, null, withLogo);
}

/**
* Return the current view as a the desired data type
* Parameters :
* - dataType: 'url', 'arraybuffer', 'blob'
* - imgType: 'image/png', 'image/jpeg'
* - width: width in pixels of the image to output
* - height: height in pixels of the image to output
* - withLogo: boolean to display the Aladin Lite logo
* Return the current view as a png Blob
*
* @API
* @memberof Aladin
*
* @param {string} dataType The type of data to return. Can be 'url', 'arraybuffer' or 'blob'
* @param {string} imgType The type of image to return. Can be 'image/png' or 'image/jpeg'
* @param {boolean} [withLogo=true] Display or not the Aladin Lite logo
* @returns {Promise<any>}
*/
View.prototype.getViewData = async function (dataType, imgType, width, height, withLogo=true){
Aladin.prototype.getViewData = async function (dataType, imgType, withLogo=true){
switch (dataType) {
case "url":
return await this.getCanvasDataURL(imgType, width, height, withLogo);
return await this.view.getCanvasDataURL(imgType, null, null, withLogo);
case "arraybuffer":
return await this.getCanvasArrayBuffer(imgType, width, height, withLogo);
return await this.view.getCanvasArrayBuffer(imgType, null, null, withLogo);
case "blob":
return await this.getCanvasBlob(imgType, width, height, withLogo);
return await this.view.getCanvasBlob(imgType, null, null, withLogo);
default:
throw new Error("Unknown data type: " + dataType);
}
Expand Down

0 comments on commit 8cda872

Please sign in to comment.