loadTable in constructor - check data is loaded

I know that you should call loadTable in preload, so that the data will will be loaded before setup is called.

But I want to call loadTable in a constructor, but make sure it is loaded before continuing.

I don’t have ES8 (so can’t use async/await) so I think I have to use a callback? But this can only detect errors in the file (e.g. it can’t find it) - I think?

Can somebody tell me how I handle this?



Managed to work it out:

this.csvData = loadTable(file, ‘csv’, ‘header’,
function(){print(‘Data loaded okay’)});

1 Like