N3
たとたんに
The instant or moment, As soon as, Just as
高速に乗った途端に、タイヤがパンクした。
The moment I got on the highway, my tire got punctured.
Explanation
「〜たとたん(に)」 follows the ta-form and means 'the moment ...'. Right as the first action finishes, something else suddenly happens: 「ドアを開けたとたん、強い風が入ってきた」 (The moment I opened the door, a strong wind blew in). The second part is something the speaker did not expect.
Mixed up with
The second half cannot be the speaker's will, plan, wish or command: you cannot say 「家に帰ったとたんに、勉強しよう」.
「〜次第」: attaches to the verb stem and means 'as soon as (it is ready), then (I will do)'; it can carry will: 「決まり次第、ご連絡します」.
「〜かと思うと/かと思ったら」: no sooner ... than it changes, a sharp contrast (cried, then laughed).
「〜が早いか」: actions follow almost instantly (more literary, harder).
In a test: ta-form before it, and an unexpected event after it (fell down, burst into tears, weather turned) points to 「たとたんに」.