Let’s look at how we can say something happened while we were doing something else.
While I was watching TV, a big spider fell on my head.
The two ways of we are going to take a look at today are:
While A was happening, (unexpectedly) B happened.
A is in the continuous form (て form plus いる). – In the second style we use the past form of いる – いた. In both cases B is the unexpected event that happened during A.
It is important to note that we cannot use this form for instances where B is something we decided to do. For example, we couldn’t use this style to say “While I was watching TV, I ate pizza”; There are different forms for those occasions (ながら for example). This style is often used for unexpected events; events beyond the control of the speaker, like the spider falling on my head in the example above.
Some of you eagle eyed people have probably already noticed that this is actually just the たら and と conditionals and yes, you are correct, but remember conditionals in Japanese often act as much more than just if.