The 每当…时 structure emphasizes that an action happens every time a circumstance arises.
Scheme
每当
(subject)
predicate 1
时
subject
predicate 2
Pay attention
If there is one subject, it is placed in the second part of a sentence.
If there are two subjects, the first one is placed after 每当 and the second one is placed in the second part of a sentence.
Examples
每当有工作要做时,他就溜走
Whenever there’s a job to do, he slips away
měidāng yǒu gōngzuò yào zuò shí, tā jiù liū zǒu
每当我们遇到困难时, 他们总来帮助我们
Whenever we’re in trouble, they are always there to help