JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.js"></script>
JavaScript
// define your module here
var Module_BarDataDaily = function(data) {
this.data = data;
};
var myModule;
var process = function(){
console.log(myModule);
}
// load your csv once and save the data
d3.csv("https://bl.ocks.org/enjalot/raw/1525346/c4603a8d7dedc7e8c8f705ca8252a335b49e03dc/prices.csv", function(error, data) {
// with some proper error handling...
myModule = new Module_BarDataDaily(data);
// so then you can do anything after that and your myModule will have data without calling d3.csv again
process();
});