mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-21 17:41:28 -08:00
Better event-dispatcher with liteners that die with scope
This commit is contained in:
1 parent
8e19542c82
commit
05fbf64ac3
35 files changed
+174
-174
No files matched your search
@@ -10,6 +10,7 @@ import dev.slimevr.buildTestUserConfig
|
||||
import dev.slimevr.buildTestVrServer
|
||||
import dev.slimevr.context.Context
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.test.advanceTimeBy
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import solarxr_protocol.MessageBundle
|
||||
@@ -46,7 +47,7 @@ private fun testConn(backgroundScope: kotlinx.coroutines.CoroutineScope, onSend:
|
||||
rpcDispatcher = EventDispatcher(),
|
||||
)
|
||||
bridge.startObserving()
|
||||
bridge.outbound.on<MessageBundle> { _ -> onSend(ByteArray(0)) }
|
||||
bridge.outbound.on<MessageBundle> { onSend(ByteArray(0)) }.launchIn(backgroundScope)
|
||||
return bridge
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user