'List All Highcharts on Page in Svelte

We are investigating multiple new web development stacks in an effort to get away from VB.NET. I have created a page using Svelte 3 architecture to replicate what we have on one existing .NET-based page. We use Highcharts for our charting library. I am able to get the charts to show up. However, other logic we use to get list of all charts on the page always returns an empty array:

export const DestroyChartReferenceByClassName = (className) => {
    var cssClassName = className;
    jquery(Highcharts.charts).each(function (i, chart) {
        if (typeof chart !== 'undefined') {
            if (chart.container.classList.contains(cssClassName)) {
                chart.destroy();
            }
        }
    });
};

When I call this method it runs without errors. However, Highcharts.charts is an empty array. What is the preferred method to iterate over the Highchart charts on a Svelte page?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source