Dots and critical hits

At what point are critical hits calculated when it comes too dots is is when the dot damage hits or when the dot is applied too the enemy (normally this would be completely inconsequential but for the building I’m doing it will actually matter for once)