N2
か〜ないかのうちに
Right after, As soon as, Just when, Barely
彼は椅子に座るか座らないかのうちに、テレビをつけた。
He turned his TV on just as he sat down.
Explanation
Built from the same verb twice, positive then negative: 「dictionary/た form + か + ない form + かのうちに」. It means 'hardly had ... begun (or finished) when ... happened', two events almost at the same instant: 「ベルが鳴るか鳴らないかのうちに、生徒が飛び出した」 (The students rushed out the moment the bell rang). The second part must be a plain fact.
Mixed up with
The second part cannot be your own will, a command or a suggestion: not 「×ベルが鳴るか鳴らないかのうちに、席を立とう」.
「たとたん(に)」: the first action finishes and an unexpected change follows at once. 「立ち上がったとたんに、めまいがした」 (I stood up and got dizzy right away).
「次第」: once the first thing is done, you do the next on purpose. 「着き次第、電話します」 (I'll call as soon as I arrive).
「や否や」: written style, the second event follows the instant the first happens.