This grammar shows that one thing happens right after another. The second thing is often a surprise. The same person usually does both actions.
に、。
As soon as my son got home, he threw down his bag and went out to play.
、に。
The department head, immediately upon reading the report, called an emergency meeting.
、。
The moment he saw my face, he left without saying a word.
、。
As soon as the thief opened the window the alarm blared, so he fled without stealing anything.
、。
As soon as the baby drank its milk, it fell sound asleep.