/** Ċ Ġ* ĠCreated Ġby ĠChris ĠRen f row Ġon Ġ 9 / 2 1 / 2 0 . Ċ Ġ*/ Ċ Ċ package Ġcom . cre n 9 0 . event bus Ċ Ċ import Ġkotlinx . coroutines . Experimental Cor outines Api Ċ import Ġkotlinx . coroutines . channels . Broadcast Channel Ċ import Ġkotlinx . coroutines . channels . Channel Ċ import Ġkotlinx . coroutines . flow .* Ċ import Ġjava . util .* Ċ Ċ @ Experimental Cor outines Api Ċ object ĠEvent Bus Ġ{ ĊĠĠĠ Ġprivate Ġval Ġchannel Ġ= ĠBroadcast Channel < Pair < Any , ĠCalendar >>( Channel . BUFFER ED ) ĊĊĠĠĠ Ġfun Ġpost ( event : ĠAny ) Ġ{ ĊĠĠĠĠĠĠĠ Ġchannel . offer ( Pair ( event , ĠCalendar . getInstance ())) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Events ( include Current Value : ĠBoolean Ġ= Ġfalse ): ĠFlow < Any > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcalendar Ġ= ĠCalendar . getInstance () ĊĊĠĠĠĠĠĠĠ Ġreturn Ġchannel . as Flow (). filter Ġ{ Ġinclude Current Value Ġ|| Ġ! it . second . before ( calendar ) Ġ}. map Ġ{ Ġit . first Ġ} ĊĠĠĠ Ġ} Ċ }