‘-자마자’ is used when an actions happens right after another action.
● 도착하자마자 전화하세요. (Please call me right after arriving.)
● 제 친구는 가방을 사자마자 잃어버렸어요. (My friend lost his bag as soon as he bought it.)
● 저하고 준수는 만나자마자 친해졌어요. (Junsu became close with me from the moment we met.)