Compare commits

...

1 Commits

3 changed files with 17 additions and 15 deletions

View File

@@ -32,7 +32,7 @@
"@babel/preset-env": "^7.18.2", "@babel/preset-env": "^7.18.2",
"@wasm-tool/wasm-pack-plugin": "^1.6.0", "@wasm-tool/wasm-pack-plugin": "^1.6.0",
"babel-loader": "^8.2.5", "babel-loader": "^8.2.5",
"npm": "^8.19.2", "npm": "^9.6.6",
"terser-webpack-plugin": "^5.3.3", "terser-webpack-plugin": "^5.3.3",
"webpack": "^5.74.0", "webpack": "^5.74.0",
"webpack-cli": "^4.9.0", "webpack-cli": "^4.9.0",

View File

@@ -1083,8 +1083,8 @@ export let Aladin = (function () {
// @oldAPI // @oldAPI
Aladin.prototype.createImageSurvey = function(id, name, rootUrl, cooFrame, maxOrder, options = {}) { Aladin.prototype.createImageSurvey = function(id, name, rootUrl, cooFrame, maxOrder, options = {}) {
let cfg = this.cacheSurveys.get(id); let survey = this.cacheSurveys.get(id);
if (!cfg) { if (!survey) {
// Add the cooFrame and maxOrder given by the user // Add the cooFrame and maxOrder given by the user
// to the list of options passed to the ImageSurvey constructor // to the list of options passed to the ImageSurvey constructor
if (cooFrame) { if (cooFrame) {
@@ -1095,13 +1095,13 @@ export let Aladin = (function () {
options.maxOrder = maxOrder; options.maxOrder = maxOrder;
} }
cfg = {id, name, rootUrl, options}; const cfg = {id, name, rootUrl, options};
this.cacheSurveys.set(id, cfg); survey = new ImageSurvey(cfg.id, cfg.name, cfg.rootUrl, this.view, cfg.options);
} else {
cfg = Utils.clone(cfg) this.cacheSurveys.set(id, survey);
} }
return new ImageSurvey(cfg.id, cfg.name, cfg.rootUrl, this.view, cfg.options); return survey;
}; };
Aladin.prototype.createImageFITS = function(url, name, options = {}, successCallback = undefined, errorCallback = undefined) { Aladin.prototype.createImageFITS = function(url, name, options = {}, successCallback = undefined, errorCallback = undefined) {
@@ -1116,15 +1116,15 @@ export let Aladin = (function () {
// Do not use proxy with CORS headers until we solve that: https://github.com/MattiasBuelens/wasm-streams/issues/20 // Do not use proxy with CORS headers until we solve that: https://github.com/MattiasBuelens/wasm-streams/issues/20
//url = Utils.handleCORSNotSameOrigin(url); //url = Utils.handleCORSNotSameOrigin(url);
let cfg = this.cacheSurveys.get(url); let image = this.cacheSurveys.get(url);
if (!cfg) { if (!image) {
cfg = {url, name, options, successCallback, errorCallback} const cfg = {url, name, options, successCallback, errorCallback};
this.cacheSurveys.set(url, cfg);
} else { image = new ImageFITS(cfg.url, cfg.name, this.view, cfg.options, cfg.successCallback, cfg.errorCallback)
cfg = Utils.clone(cfg) this.cacheSurveys.set(url, image);
} }
return new ImageFITS(cfg.url, cfg.name, this.view, cfg.options, cfg.successCallback, cfg.errorCallback); return image;
}; };
Aladin.prototype.newImageSurvey = function(rootUrlOrId, options) { Aladin.prototype.newImageSurvey = function(rootUrlOrId, options) {
@@ -1615,6 +1615,7 @@ export let Aladin = (function () {
/////////////////////////////// ///////////////////////////////
export let A = {}; export let A = {};
export default A; export default A;
//module.exports = A;
//// New API //// //// New API ////
// For developers using Aladin lite: all objects should be created through the API, // For developers using Aladin lite: all objects should be created through the API,

View File

@@ -16,6 +16,7 @@ module.exports = {
filename: 'aladin.js', filename: 'aladin.js',
// Keep in dist/ only files used // Keep in dist/ only files used
clean: true, clean: true,
//publicPath: '',
}, },
resolve: { resolve: {
extensions: ['.js', '.glsl', '.vert', '.frag'], extensions: ['.js', '.glsl', '.vert', '.frag'],