just as; right after; as soon as
Describes an action that happens immediately after another action, often before the first action is fully completed.
This pattern expresses that something occurs right at the moment another action finishes or even before it is completely done. It emphasizes the immediacy and sometimes the surprise of the second action. The structure is like 'no sooner... than' in English. For example, you can say ベッドに入るか入らないかのうちに眠ってしまった (I fell asleep the moment I got into bed). The verb before か is often in the dictionary form or た-form, but the negative form is always ない-form. The second clause describes an event that happens almost simultaneously, often with a nuance that it was quicker than expected. This is a somewhat formal, written expression, but it is also used in speech when telling stories or narrating events. It is not used in casual everyday chit-chat.