Grammar
N1AI-drafted〜なり(〜たとたん)
as soon as; the moment someone did
Formation
V辞書形 + なり
Usage
A literary pattern meaning that immediately after the first action, an unexpected or striking second action follows. The subject of both clauses must be the same third person, the second clause states a past fact (no commands, invitations, volition or negatives), and the speaker's own actions are not normally described this way. Compared with 〜たとたん it feels more written and narrative, common in novels.
Examples
娘は家に帰るなり、自分の部屋に閉じこもった。
むすめはいえにかえるなり、じぶんのへやにとじこもった。
The moment my daughter got home, she shut herself in her room.
彼はその知らせを聞くなり、顔色を変えて飛び出して行った。
かれはそのしらせをきくなり、かおいろをかえてとびだしていった。
The instant he heard the news, he turned pale and rushed out.
赤ん坊は母親の姿を見るなり、泣き出した。
あかんぼうははははおやのすがたをみるなり、なきだした。
As soon as the baby saw its mother, it burst into tears.