Past tense + 途端[とたん]+

expresses what occurs immediately after an action.
it can only be used for an action that is involitional; you cannot have control over it.

窓を開けたとたんに、猫が跳んでいた。 Immediately after I opened the window, the cat jumped out.

映画を観たとたんに、眠くなりました。 Immediately after watching the film, I became sleepy.

布団に入った途端に先輩から電話がかかってきた。 Immediately after I got into the futon, I received a phone call from senpai.

Differences with similar points

Just finished doing (...) すぐ: Immediately after, not soon after. から: とたん does not imply a causality.