package Ġio . ro ver . sdk . services Ċ Ċ import Ġio . ro ver . sdk . data . events . R over Event Ċ import Ġio . ro ver . sdk . logging . log Ċ import Ġio . ro ver . sdk . streams . Publish Subject Ċ import Ġio . ro ver . sdk . streams . share Ċ import Ġorg . reactiv est ream s . Publisher Ċ Ċ /** Ċ Ġ* ĠProvides Ġa Ġsingle Ġsource Ġfor ĠR over Ġevents Ġbeing Ġemitted . Ċ Ġ* Ċ Ġ* ĠYou Ġcan Ġsubscribe Ġto Ġthe Ġ[ tracked Events ] ĠPublisher Ġto Ġbe Ġin formed Ġof Ġthem . Ċ Ġ* Ċ Ġ* ĠAlternatively , Ġyou Ġcan Ġadd Ġa Ġ[ R over EventListener ] Ġto Ġreceive Ġevent Ġupdates Ċ Ġ*/ Ċ class ĠEventEmitter Ġ{ ĊĠĠĠ Ġprivate Ġval Ġevent Subject Ġ= ĠPublish Subject < R over Event >() ĊĊĠĠĠ Ġval Ġtracked Events : ĠPublisher < R over Event > Ġby Ġlazy Ġ{ Ġevent Subject . share () Ġ} ĊĊĠĠĠ Ġinternal Ġfun Ġtrack Event ( ro ver Event : ĠR over Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġevent Subject . onNext ( ro ver Event ) ĊĠĠĠĠĠĠĠ Ġlog . d (" Event Ġemitted : Ġ$ ro ver Event ") ĊĠĠĠĠĠĠĠ Ġwhen Ġ( ro ver Event ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Block T apped Ġ-> Ġlisteners . forEach Ġ{ Ġit . on Block T apped ( ro ver Event ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Experience Dis missed Ġ-> Ġlisteners . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . on Experience Dis missed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġro ver Event ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Screen Dis missed Ġ-> Ġlisteners . forEach Ġ{ Ġit . on Screen Dis missed ( ro ver Event ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Experience Present ed Ġ-> Ġlisteners . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . on Experience Present ed ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġro ver Event ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Experience View ed Ġ-> Ġlisteners . forEach Ġ{ Ġit . on Experience View ed ( ro ver Event ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Screen View ed Ġ-> Ġlisteners . forEach Ġ{ Ġit . on Screen View ed ( ro ver Event ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Screen Present ed Ġ-> Ġlisteners . forEach Ġ{ Ġit . on Screen Present ed ( ro ver Event ) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġis ĠR over Event . Poll Answer ed Ġ-> Ġlisteners . forEach Ġ{ Ġit . on Poll Answer ed ( ro ver Event ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġlisteners : ĠMutable List < R over EventListener > Ġ= Ġmutable ListOf () ĊĊĠĠĠ Ġfun Ġadd EventListener ( listener : ĠR over EventListener ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlisteners . add ( listener ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġremove EventListener ( listener : ĠR over EventListener ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlisteners . remove ( listener ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġremove All Listeners () Ġ{ ĊĠĠĠĠĠĠĠ Ġlisteners . clear () ĊĠĠĠ Ġ} Ċ } Ċ Ċ interface ĠR over EventListener Ġ{ ĊĠĠĠ Ġfun Ġon Block T apped ( event : ĠR over Event . Block T apped ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Experience Dis missed ( event : ĠR over Event . Experience Dis missed ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Screen Dis missed ( event : ĠR over Event . Screen Dis missed ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Experience Present ed ( event : ĠR over Event . Experience Present ed ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Experience View ed ( event : ĠR over Event . Experience View ed ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Screen View ed ( event : ĠR over Event . Screen View ed ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Screen Present ed ( event : ĠR over Event . Screen Present ed ) Ġ{} ĊĊĠĠĠ Ġfun Ġon Poll Answer ed ( event : ĠR over Event . Poll Answer ed ) Ġ{} Ċ }