adverb
nearly; almost; on the verge of
Used adverbially to indicate that something almost happened, often with a sense of narrowly avoiding an undesirable outcome. Common with verbs in the potential or past tense.
危なく電車に乗り遅れるところだった。
I almost missed the train.
危なく事故になるところだった。
It nearly turned into an accident.