Using d3.carto.layer with d3.carto.map.
Each d3.carto.layer is defined and then added to the map using map.addCartoLayer. You can access the added layers using map.layers(). Each layer fires a “load” event once successfully added to the map.