From da883fd7240868f7af4f030c9117790273e3ed8e Mon Sep 17 00:00:00 2001 From: Joshua Orvis Date: Sun, 14 Jan 2024 14:43:35 -0600 Subject: [PATCH] Added callback function support to both dataset and gene collection widget loading --- .../dataset-collection-selector.js | 3 ++- .../gene-collection-selector/gene-collection-selector.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/www/include/dataset-collection-selector/dataset-collection-selector.js b/www/include/dataset-collection-selector/dataset-collection-selector.js index 525d1ca5..344285ab 100644 --- a/www/include/dataset-collection-selector/dataset-collection-selector.js +++ b/www/include/dataset-collection-selector/dataset-collection-selector.js @@ -103,7 +103,7 @@ document.addEventListener('DOMContentLoaded', () => { }); }); -const fetchDatasetCollections = async () => { +const fetchDatasetCollections = async (callback) => { try { dataset_collection_data = await apiCallsMixin.fetchDatasetCollections(); document.querySelector('#dropdown-dc').classList.remove('is-loading'); @@ -119,6 +119,7 @@ const fetchDatasetCollections = async () => { } } + callback(); } catch (error) { console.error(error); diff --git a/www/include/gene-collection-selector/gene-collection-selector.js b/www/include/gene-collection-selector/gene-collection-selector.js index 52116a7e..f8c9ebc7 100644 --- a/www/include/gene-collection-selector/gene-collection-selector.js +++ b/www/include/gene-collection-selector/gene-collection-selector.js @@ -145,7 +145,7 @@ document.addEventListener('DOMContentLoaded', () => { }); }); -const fetchGeneCartData = async () => { +const fetchGeneCartData = async (callback) => { try { gene_cart_data = await apiCallsMixin.fetchGeneCarts('unweighted-list'); document.querySelector('#dropdown-gene-lists').classList.remove('is-loading'); @@ -157,6 +157,8 @@ const fetchGeneCartData = async () => { gene_cart_label_index[cart.share_id] = cart.label; } } + + callback(); } catch (error) { console.error(error);